PDA

View Full Version : Store showing count as zero even after loading



harsha_velicheti
27 Sep 2009, 9:29 PM
Hi,
I am facing a peculiar problem.

I am defining a store as below.
var store = new Ext.data.GroupingStore({
proxy: proxy,
reader: reader,
sortInfo: { field: 'testField', direction: "ASC" },
groupField: 'testField'
});
store.load({
params: {
query: 'null'
}
});

Now after this if i get the count by the store.getCount() method , it is showing as zero,
but when i give this store to a grid, the data is being displayed.

Please help me out if i am missing anything.
Thanks in advance.

evant
27 Sep 2009, 9:34 PM
Ajax is asynchronous, by the time you call getCount, the store hasn't loaded yet. Execute the call to getCount inside the "load" listener on the store.

harsha_velicheti
27 Sep 2009, 9:42 PM
Hi Evan,
Thanks for the reply.
I need to do a query on the store once it is loaded and take the data to a text field on the UI, now can you please let me know if i can make a wait call or some thing while the store loads.

TIA.
Regards
Harsha

evant
27 Sep 2009, 9:43 PM
Please read my previous post:



Execute the call to getCount inside the "load" listener on the store.

Animal
27 Sep 2009, 10:08 PM
This information is displayed in bold to attempt to overcome this Frequently Asked Question:

http://i131.photobucket.com/albums/p286/TimeTrialAnimal/loaddocs.jpg