我的申请是在MVC。
我有一个包含列的网格,其中一列有一个带渲染器的列。当用户点击其他网格时,此网格将打开。
当我加载我的应用程序并单击打开此网格时,此列(以及之后的其他列)不会加载。但当我关闭并重新打开此网格时,列将被加载。 我不知道问题出在哪里(此外,这个问题并没有出现在开发服务器上......)
我做了console.log(Ext.getStore('sTypesJours'))
:我有一些记录
然后我做了console.log(Ext.getStore('sTypesJours').query('uid', val, false, false, true))
:我第一次没有记录,但重新打开之后就有效了...
这是我网格的代码:
Ext.define('KGest.view.grille.Modif', {
extend: 'Ext.grid.Panel',
xtype: 'grillemodif',
title: 'Elements déjà saisis',
store: 'sGrilleModif',
dockedItems: [
{
xtype: 'toolbar',
dock: 'bottom',
itemId: 'toptoolbarService',
items: [
{
xtype: 'button',
id: 'save-button-grillemodif',
text: 'Sauver les modifications',
iconCls: 'x-icon-save',
action: 'update',
dock: 'top',
scope: this
}
]
}
],
selType: 'rowmodel',
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})
],
columnLines: true,
viewConfig: {
deferEmptyText: false,
emptyText: 'Aucune donnée déjà saisie'
},
initComponent: function() {
var me = this;
me.selModel = Ext.create('Ext.selection.CheckboxModel', {
listeners: {
selectionchange: function(sm, selections) {
Ext.getCmp('validall-button-grillemodif').setDisabled(selections.length === 0);
Ext.getCmp('supprall-button-grillemodif').setDisabled(selections.length === 0);
}
},
injectCheckbox: 7 // position de la colonne des checkbox
});
Ext.apply(me, {
columns: [
{
text: 'Journée',
dataIndex: 'journee',
allowBlank: false,
xtype: 'datecolumn',
format: 'd/m/Y',
width: 100,
editor: {
xtype: 'datefield',
submitFormat: 'Y-m-d'
}
},
{
text: 'Type de jour',
dataIndex: 'uid_types_saisies',
flex: 1,
editor: {
xtype: 'combobox',
store: Ext.create('KGest.store.sTypesJours'),
valueField: 'uid',
displayField: 'libelle',
typeAhead: true,
queryMode: 'remote',
emptyText: 'Sélectionnez un type de jour',
listeners: {
beforequery: function(queryEvent, eOpts) {
var tabFilter = new Array();
tabFilter[0] = {"property": "uid_salaries", "value": Ext.getCmp('uid_salaries').getValue()};
queryEvent.combo.store.proxy.extraParams.filter = JSON.stringify(tabFilter);
}
}
},
renderer: function(val) {
if (val > 0) {
var srvStore = Ext.getStore('sTypesJours');
detail = srvStore.query('uid', val, false, false, true);
sortie = detail.getAt(0).data.code;
}
return sortie;
}
},
{
text: '1/2<br/>jour',
dataIndex: 'demi_jour',
xtype: 'checkcolumn',
width: 50
}
]
});
me.callParent(arguments);
}
});
有没有人有任何想法?
答案 0 :(得分:0)
我能提出的最佳问题(问题提出后6个月)是:
时间就是一切,一个领域的渲染器&#39;在onload()时格式化单元格数据 - 同时,在渲染器函数中实例化并检索数据到商店(当尚未填充存储数组时)返回undefined,在下一次网格加载发生时,瞧,在已填充的商店中,您可以从查询中获得结果。 可能很久以前解决了这个问题,但加载商店(autoload:true)或实例化&#39;存储&#39;网格定义的外部范围(在调用布局/渲染器之前)