Extjs 获取奇怪错误this.grid未定义ext-all-debug.js(第47393行)
我有一个编辑网格Extjs 获取奇怪错误this.grid未定义ext-all-debug.js(第47393行),extjs,Extjs,我有一个编辑网格 Grid.Selection = Ext.extend(Ext.grid.EditorGridPanel, { layout:'fit', border:false, stateful:false, initComponent: function() { Ext.apply(this, { // {{{ store: new Ext.data.SimpleStore({ id: 0,
Grid.Selection = Ext.extend(Ext.grid.EditorGridPanel, {
layout:'fit',
border:false,
stateful:false,
initComponent: function() {
Ext.apply(this, {
// {{{
store: new Ext.data.SimpleStore({
id: 0,
fields: [ ...],
data: []
})
,cm: new Ext.grid.ColumnModel({
// specify any defaults for each column
defaults: {
sortable: true // columns are not sortable by default
},
columns: [
rowNumberer,
combo1,
combo2,
combo3,
itemDeleter]
})
// }}}
,plugins: new Ext.ux.plugins.GridValidator()
,viewConfig: {forceFit: true}
,sm: itemDeleter
,height: 150
,frame: true
,clicksToEdit: 1
,tbar: [{
text: 'Add New Association'
,id: 'addBtnGrid'
,iconCls: 'icon-plus'
,listeners: {
click: {scope: this,fn: this.addRecord,buffer: 200}
}
}]
}); // eo apply
// call parent
Grid.Selection.superclass.initComponent.apply(this, arguments);
} // eo function initComponent
// }}}
// {{{
,onRender: function() {
// call parent
Grid.Selection.superclass.onRender.apply(this, arguments);
} // eo function onRender
// }}}
// {{{
,addRecord: function() {
record = this.store.recordType;
rec = new record({
...
});
this.stopEditing();
this.store.insert(0, rec);
**this.getView().refresh(); // GETTING ERROR ON THIS LINE**
this.getSelectionModel().selectRow(0);
this.startEditing(0, 0);
} // eo function addRecord
,reset: function() {
this.store.removeAll();
this.addRecord();
}
}); // eo extend
// register xtype
Ext.reg('selectionGrid', Grid.Selection);
我将这个网格添加到表单中。
当我显示表单时,我重置了网格,从存储中删除所有记录并添加一条新记录。
但是当这个.getView().refresh()时;这叫我得到
此.grid未定义
this.grid.stopEditing(true);ext-all-debug.js(第47393行)
ItemDeleter插件[http://code.google.com/p/extensive/s...eleter.js?r=13]他也在打电话
grid.getView().refresh()但它可以工作
如果有人能指导我,我将不胜感激。问题是因为在调用getView().refresh()之前网格没有完全渲染 解决方案是在渲染网格后调用上述方法