PDA

View Full Version : loading different values into a store.



chiconerd
27 Oct 2010, 1:36 PM
Hey guys I have a store that is retreating json data what I basally want to do is when I click on a button different data is loading in to the store and the grid.. for example my current store gets json from.


store.load({params:{users:'all'}});

so I have a btn when is clicked i want the params to change and retreat different values


........,
handler: function(){
store.load({params:{user:'members'}});
},
......

so when I click on the btn I see in firebug that the post occurs and that the json is received but in the grid it still show the same old results, even if the store has new values, the grid shows the old values.. I try refreshing the grid via refresh() but nothing.. the same old data is shown in the grid.

how do I empty a store and give it the new values?

any help?

plalx
27 Oct 2010, 3:02 PM
Listen to the store load event to be sure the store gets loaded properly...

chiconerd
29 Oct 2010, 2:12 PM
Idk how I would do that :S

store.on('load', function({})); ??

plalx
30 Oct 2010, 4:52 AM
store.on({
'load': function(store, records, options) {
//This will log the records loaded after a successful load operation.
console.log('records:', records);
},
'exception': function() {
console.log('load failed!');
}
});