在Designer中設置我的網名相同MyGridExtJS的如何獲得網格
在點擊按鈕的addRecord叫,其中行被attemting獲取未定義的網格失敗。
如何定義此MyGrid以便它引用面板中的網格?
Ext.define('MyApp.view.MyPanel', {
extend: 'MyApp.view.ui.MyPanel',
initComponent: function() {
var me = this;
me.callParent(arguments);
var button = me.down('button[text=Submit]');
button.on('click', me.onSubmitBtnClick, me);
},
addRecord: function(myRecordArray) {
var rows = grid.getStore().getRange(); // ERROR happens here
console.log(rows);
},
onSubmitBtnClick: function() {
this.addRecord(["ll", "kk", "mm"]);
}
});
Chrome的JavaScript調試器控制檯 - >
Uncaught ReferenceError: grid is not defined
非常感謝你,我真的被卡在那裏 – BAR 2012-01-15 04:39:21