Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ExtJS Store/Grid reset

I have a button that when clicked, will create a JSONstore using a url provided. The store is then loaded into a grid. If the button is clicked again, it adds all the information again (so it is listed twice). I want it so that when the user clicks the button, it clears the store/grid and then adds everything.

Any ideas on how to accomplish this?

Thanks,

EDIT ExtJS 3

datasetStore.removeAll();
datasetStore.loadData(datasetsArray);
like image 897
gberg927 Avatar asked Aug 24 '26 13:08

gberg927


1 Answers

It will be useful to see some code examples (and extjs version), but you can simply use loadRecords method (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.JsonStore-method-loadRecords):

grid.store.loadRecords([array of your new records here], {addRecords: false});

{addRecords: false} indicates that existing records will be removed first.

like image 74
Pavel Podlipensky Avatar answered Aug 27 '26 05:08

Pavel Podlipensky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!