使用initComponent参数将数据实例化别忘了重新生成视图 this.callParent(arguments);
Ext.define('AM.view.show.GridPanel', {
extend: 'Ext.grid.Panel',
alias: 'widget.alias_gridpanel',
title: 'All Users',
initComponent: function () {
var mystore = Ext.create('AM.store.UserStore');
this.store = mystore;
mystore.load({
params: {
start: 0,
limit: 2
}
});
this.dockedItems = [{
xtype: 'pagingtoolbar',
store: mystore, // same store GridPanel is using
dock: 'bottom',
displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条',
emptyMsg: '没有数据',
displayInfo: true
}];
this.columns = [{
header: 'ID',
dataIndex: 'id',
flex: 1
}, {
header: 'Name',
dataIndex: 'name',
flex: 1
}, {
header: 'Password',
dataIndex: 'password',
flex: 1
}];
this.callParent(arguments);
}
});