daiei27
1 Sep 2011, 1:53 PM
I have a grid definition that includes the store configuration. When I add a paging toolbar, I need to reference the grid's store. How do I do that from the bbar code?
Ext.define('APP.session.User' ,{
extend: 'APP.Grid',
alias: 'widget.sessionuser',
bbar: Ext.create ('Ext.toolbar.Paging', {
store: this.store, // THIS DOES NOT WORK!
pageSize: 5,
}),
initComponent: function() {
this.store = {
data: [
{ name: 'Anne', age: 39 },
{ name: 'Baker', age: 38 },
{ name: 'Chris', age: 37 },
{ name: 'Dave', age: 36 },
{ name: 'Ewan', age: 35 },
{ name: 'Fred', age: 34 },
{ name: 'Garth', age: 33 }
],
fields: ['name', 'age'],
};
this.columns = [
{
text: 'Name',
dataIndex: 'name'
},{
text: 'Age',
dataIndex: 'age'
},
];
this.callParent(arguments);
},
});
Is my only option to create the store separately before the grid? I really wanted to keep the grid self-contained so if anyone knows how to dynamically reference the grid in this situation, I'd love to hear it!
Thanks in advance!
Ext.define('APP.session.User' ,{
extend: 'APP.Grid',
alias: 'widget.sessionuser',
bbar: Ext.create ('Ext.toolbar.Paging', {
store: this.store, // THIS DOES NOT WORK!
pageSize: 5,
}),
initComponent: function() {
this.store = {
data: [
{ name: 'Anne', age: 39 },
{ name: 'Baker', age: 38 },
{ name: 'Chris', age: 37 },
{ name: 'Dave', age: 36 },
{ name: 'Ewan', age: 35 },
{ name: 'Fred', age: 34 },
{ name: 'Garth', age: 33 }
],
fields: ['name', 'age'],
};
this.columns = [
{
text: 'Name',
dataIndex: 'name'
},{
text: 'Age',
dataIndex: 'age'
},
];
this.callParent(arguments);
},
});
Is my only option to create the store separately before the grid? I really wanted to keep the grid self-contained so if anyone knows how to dynamically reference the grid in this situation, I'd love to hear it!
Thanks in advance!