PDA

View Full Version : Grid not loading data



bluewwol
4 Jun 2014, 6:26 AM
Hi,

I have a curious problem, resulting from the following Store, and grid. When the stores autoLoad property is set to false. Observationally when I open the formPanel containing the grid, the grid state is loading forever. If I close the formPanel and reopen it the grid loads perfectly. Also if I set the autoLoad property of the Store to true then the grid loads perfectly the first time.

I would like to have all my stores autoLoad be false to save time with the initial application load as there are a lot of them.

Any thoughts would be welcome.

-Allen


here is the function called in the formPanel that holds the grid onBeforeRender event

var a1 = Ext.getCmp('userGridID');a1.getStore().load();
a1.getView().refresh();

here is the store:

Ext.define('ExtDesktop.store.usersJsonStore', { extend: 'Ext.data.Store',


requires: [
'ExtDesktop.model.usersData'
],


constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: false,
filterOnLoad: false,
model: 'ExtDesktop.model.usersData',
sortOnLoad: false,
storeId: 'stid1',
buffered: true,
proxy: {
type: 'ajax',
url: 'getUsers',
reader: {
type: 'json',
messageProperty: 'advisory',
root: 'data',
totalProperty: 'records'
}
}
}, cfg)]);
}
});

scottmartin
4 Jun 2014, 7:57 AM
When you call load, is your server response as expected?

Any errors in the console and do you have an instance of the store created in your controller?



stores: ['usersJsonStore']


Scott.

bluewwol
4 Jun 2014, 10:07 AM
Yes, in the developer tools I see the JSON and there are no differences between the the JSON the first time when it does not load and the the second time when it does. also the time taken for the browser to receive the data is about the same.no errors in the console, and when I add log entries they all get rendered to the console.mystified?as I said the only attribute that I change is the autoload and then all works as expected.Thanks for the help Scott,

scottmartin
4 Jun 2014, 10:47 AM
I guess the next step would be an example. Something like this that loads your json data:
https://fiddle.sencha.com/#fiddle/1ru

Scott.

bluewwol
5 Jun 2014, 6:16 AM
Scott, thanks again for the help, I will get some time over the weekend to strip it down to a simple example. In the mean time I am making thevar a1 = Ext.getCmp('userGridID');a1.getStore().load();a1.getView().refresh();calls in both the beforeRender and afterRender events, and it is functional (all be it very ugly).thanks again for your time, will pick this up over the weekend.And thanks to all who have contributed to these forums where I have learned so very much.

bluewwol
8 Jun 2014, 7:56 AM
Scott;

Here is a complete and simple project that replicates the problem I am experiencing.

the zip file currently should work is unzipped directly to a folder named test directly on the root of the webserver. The data (json) is loaded from a text file included.

In its current state there is a call to load the grid store in the views onFormAfterRender and onFormBeforeRender events.

When both of these are present the grid loads, when one is removed the grid never completes loading.

If one sets the stores autoload property to true then the form laods as expected.

Any help appreciated.

thanks,

-Allen