PDA

View Full Version : How to reaload a store?



wesDuff
27 Sep 2008, 11:46 AM
I have this data store that I am trying to reload its info.

Here is the structure.

Click on the tab that says developers.
There is an editable grid with the developers name and availability.
You can add a new developer or delete an exisiting developer from the grid.

Here are the readers and data stores I am using.

NOTE: The onload is uesed for my progress bar at the begginning.





var DesDev_reader = new Ext.data.ArrayReader({},[
{name:'id'},
{name:'name'},
{name:'phone'},
{name:'availability'}
]); // used for grids
var DesDev_combo_reader = new Ext.data.ArrayReader({},[
{name:'id'},
{name:'name'}
]); //used for comboboxes

//Developers
var DSdeveloper = new Ext.data.Store({
data:getDevelopers(), //server-proxied callback function
reader: DesDev_reader
});
DSdeveloper.on("load",doIncrement("DSdeveloper",.85,false));
var DSdeveloper_combo = new Ext.data.Store({
data:getDevelopers(),
reader: DesDev_combo_reader
})



After I update the developer grid's combobox for developers to be updated.

I can update the developer grid by adding this code after successful add or delete



developerGrid.getStore.loadData(getDevelopers());


But when I do this I also want to refresh the developer combobox like this:



DSdeveloper_combo.loadData(getDevelopers());


I can put the DSdeveloper_combo.loadData(getDevelopers()); before the developerGrid.getStore.loadData(getDevelopers()); and DSdeveloper_combo.loadData(getDevelopers()); works but developerGrid.getStore.loadData(getDevelopers()); will not work and vice versa.

I am using Jaxer to handle the backend and return the data via arrays.

I think I am just trying to reload the DSdeveloperGrid in the wrong way but really seem to be stumped.

Any help will be appreciated.

Thanks

wesDuff
27 Sep 2008, 11:48 AM
I just noticed while I was typing this that the reason for the second load not to work was because on the onload function I was calling right below the stores.

All good now. I just had to change my preloader.

joehebe
27 Sep 2008, 7:26 PM
Ext.StoreMgr.lookup('XXX').reload()

devnull
29 Sep 2008, 6:33 AM
Joehebe, load() and reload() are for stores that use remote data (via use of a proxy) and are not applicable here.

shuang
2 Oct 2008, 12:30 AM
DSdeveloper.reload();