PDA

View Full Version : Reload Store with Form submit response



mannyk
12 Aug 2010, 12:33 AM
Hello,

I'd like to reload my store after submitting a form. I already have the Json response object (located at options.response) but the store does not seem to reload (since the data in the gridpanel is not updated).



formSearch.submit({
waitMsg: 'Searching...',
success: function (response, options) {
MyGrid.store.load(options.response);
}

});


Thank you very much!
mannyk

qooleot
12 Aug 2010, 3:42 AM
I haven't tried your code, but a few quick ideas just to try:

1) Make sure the store isn't actually trying to load (say if modal was off and the ajax wasn't proper JSON or something). To test, try running the load command in firebug by hand instead of in the callback of the other ajax call and make sure that works.

2) Also, write a console.log(options); statement and have firebug open before calling the load to make sure the response is what you are expecting.

3) Try MyGrid.getStore.load(options.response) - the store isn't listed as a public parameter in the GridPanel api so I'd use the method.

mannyk
12 Aug 2010, 6:44 AM
Hello and thank you for your advice!

I tried MyGrid.getStore.load(options.response) but it does not work too. Also im not sure, which object I have to pass to the store. The JSON string is located in options.response.responseText. (However, this does not work either).

Im debugging the app with Visual Studio and Firebug, so I am sure that the object is valid.

qooleot
12 Aug 2010, 6:59 AM
Its MyGrid.getStore().load(options.response) and not MyGrid.getStore.load(options.response) as you posted. Also, I think you're going to need to post the response from options.response from firebug or whatnot and also put a listener (and alert statement) on the before load event for the store to verify its actually not being called. At this point, I'm not sure if the problem is your options.response has something invalid or something is wrong with the store not loading.