View Full Version : Custom GridPanel instatiation problem with store

14 Oct 2013, 2:10 AM

I want to create three custom GridPanels.
The first two, that have the same Store, work alright.

The third GridPanel however, although it retrieves the data just fine, it does not display it.

I realized this is because of the different Store. The this.store.fields, this.store.proxy.type, this.store.proxy.url still have the values of the previously instantiated GridPanels, so when instantiating a GridPanel with different store fields, this becomes a problem.

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.

The Custom GridPanel class :

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

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

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

constructor : function()

initComponent: function()
this.store.fields = this.storeFields;

this.store.proxy.type = this.proxyType;
this.store.proxy.url = this.proxyUrl;

addToComponentManager(this, this.getXType());

14 Oct 2013, 2:25 AM
Don't modify configs, that are passed by reference.
Try to create store config object with proper fields, proxy, url in the initComponent and remove it from config section.