Login Register

How to feed the datastore with data and refresh it by url

Hi,

I have got a data store defined with a "data" property instead of "url" because the data is already known when the HTML page is sent by the server, and I can thus avoid an XHR request to the server afer the page is loaded.

var data = { /* Object initially populated by my PHP script */ };
var store = new dojo.data.ItemFileWriteStore({ data: data });

Then, if something goes wrong with my custom save function (as this data store populates an editable grid), I would like to get data back from the server, as if I had defined the data store with an "url" property, and refresh the grid after the data has been received.

Is there a solution to do it?
--
Guillaume ORIOL

setStore

Setting a new store usually does it for a grid.

grid.setStore(new dojo.data.ItemFileWriteStore({url:'path/file'}));

Thank you fivefeet8. Is the

Thank you fivefeet8.
Is the refresh automatic then?
--
Guillaume ORIOL

setStore will refresh the grid

The new store will refresh it's data from the url and the grid setStore function will set the new data to it's display.