PDA

View Full Version : Custom GridPanel problem with store



hermann.s
11 Oct 2013, 4:34 AM
I have a custom GridPanel class.

At some point, I create 3 GridPanels.

The first two, that have the same Store model, work alright.
The third GridPanel however, although it retrieves the data just fine, and everything should be working fine, does not display the data.

I realized this is because of the different Store model.
Please take a look at the initComponent method. Debugging it and checking out this.store.fields seems to bring up the store fields of the previously instantiated GridPanel. And although the content is overwritten with the correct model, it seems like at this point, the damage is done.

Any ideas?


Ext.define('Base.GridPanel', {
extend: 'Ext.grid.Panel',
xtype: 'gridpanel',

config:
{
@* defaults *@
hideMode: 'offsets',
collapsible: true,

storeFields: [],
proxyType: '',
proxyUrl: '',
store :
{
fields: [],
proxy:
{
type: '',
url: '',
reader:
{
type: 'json',
root: 'data',
totalProperty: 'total'
},
actionMethods: {read: 'POST'}
},
pageSize: 5,
autoLoad: true
},
columns: [],
dockedItems: [],
hasPagingToolbar: false
},

initComponent: function()
{
this.store.fields = this.storeFields;
this.store.proxy.type = this.proxyType;
this.store.proxy.url = this.proxyUrl;


@* if (this.hasPagingToolbar)
{
this.dockedItems = Ext.create('Ext.toolbar.Paging', {
store: this.getStore(),
displayMsg: '{0} - {1} of {2}',
emptyMsg: 'No data to display',
dock: 'bottom'
});
}*@

this.callParent();
addToComponentManager(this, this.getXType());
}
});

mitchellsimoens
14 Oct 2013, 2:09 PM
Couple things. For Ext JS, you shouldn't use the config object as it's not well implemented throughout the framework. Also not sure what addToComponentManager does.