View Full Version : How to reload a store ?

4 Aug 2010, 1:53 AM
Hi everyone,

Everything is in the title. I have a Ext.data.GroupingStore and I want to reload it after having clicked on a button.

I try to use the load() function but it didn't work.

My store :

var store = new Ext.data.GroupingStore({
proxy: new Ext.data.HttpProxy({
url: 'Name of my servlet', timeout: 300000}),
reader: new Ext.data.JsonReader({
root: "result",
fields: [
{name: "Id"},
{name: "movieTitle"},
{name: "type"}
remoteSort: false,
sortInfo: {
field: 'type',
direction: 'ASC'
data: {result:rs.storeList},
fields: ["Id","movieTitle","type"],
groupField: "type"

in my function called when the button is clicked :


I know load() function is asynchronous. i see with firebug that my rs.storeList has been updated but i don't know how to use my updated list.

Any tips ?

4 Aug 2010, 2:07 AM
Look at the API to see if there's a reload function?

4 Aug 2010, 3:35 AM
I saw the REload() function but i don't know why i can't make it work.

4 Aug 2010, 3:57 AM
What debugging have you done?

4 Aug 2010, 4:05 AM
Quite simple actually.
I put two alerts : one before the reload() function call and the same after : alert(store.getCount()). Both display the same number.

4 Aug 2010, 4:06 AM
Loading is asynchronous!!!

You can only check the number of records AFTER the new data from the server is received.


callback: function(){

4 Aug 2010, 4:14 AM
Still the same number even if i use your code Condor.
I don't know what to do. The most frustating is that I can see in the servlet response displayed by firebug the result I want.

4 Aug 2010, 4:30 AM
Are you saying the new Records are not being loaded? I don't understand what the problem is.

4 Aug 2010, 4:37 AM
When I call the reload() function, I see in the firebug console that my servlet is actually called and returned the right list. But the data in my store remain the same.

4 Aug 2010, 4:39 AM
Yeah, you're right, the new Records aren't being loaded from the servlet response.

4 Aug 2010, 4:39 AM
Would the data have changed? It's a reload operation.

4 Aug 2010, 4:44 AM
Yeah it's a reload operation. But data in my store aren't reloaded when i call reload() function.

4 Aug 2010, 6:07 AM
Animal, have you any other tips to propose to me ? I don't know how to figure it out.

Actually, I add logs in the firebug console and saw that the jsonData associated to the reader of my store is not updated with the servlet response to my request.

4 Aug 2010, 6:16 AM
1. Some people actually assign a different store to a grid after it has been created. Hopefully, you don't do that?
2. Do you get an 'exception' event when you reload the store? (try adding an exception listener)

4 Aug 2010, 6:44 AM
you are right, i add a listener and i have a syntax error.

4 Aug 2010, 7:22 AM
I think i understand what wrong with my code. It's not in my ext-js page but in my Servlet maybe.