Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extjs How to stop reloading a store

I'm building an application using Ext Js MVC approach.

I have a couple of combos on different views bound to one store. The store is set to query: remote and autoLoad: false and loads its data from server.

The problem every time I change the view (the old view is destroed) and expand the combo, the store will reload its data. Is there any way to force the store to load its data only once ? When the store is once loaded it will not reload it again even the bound combo is destroed.

like image 635
user49126 Avatar asked Feb 15 '13 09:02

user49126


1 Answers

There are ways to do this on the combobox itself but I think the easiest way for you is to subscribe to the load event of the store and check if the store contains records, if so abort the loading.

store.on('beforeload', function(s){
    return !s.count() > 0;
});
like image 192
sra Avatar answered Sep 16 '22 21:09

sra