Reputation: 27
I am aggregating data from multiple sources and displaying it in a single grid. The data is all in the same format. In order to accomplish this I am loading data from multiple sources into a unique store and then loading the records into the main store for display purposes.
The data is loading fine, but I have a dynamic model that re formats the data to display in the grid. This model has to be changed on load time it cannot be hard coded in the model file. However once all the data is loaded from the additional stores and displayed the model fields are not set on the store. The normal way to force the store to apply the model is to call store.load()
, however when I call store.load()
it removes the manually added data from the other stores. How can I force this data to persist in the store or is there a way to force the store to apply the model without requesting the data from the url?
How can I force manually added records to persist in the store or is there a way to force the store to apply a dynamic model without requesting the data from the url?
Upvotes: 1
Views: 1958
Reputation: 702
You could just re-load the data in your store (As you already have all the data you need) in my opinion. With ExtJs 4.2 you could try this code:
yourStore.loadRawData(yourStore.data.items, false)
This should ensure that all your fields are set correctly. https://docs.sencha.com/extjs/4.2.6/#!/api/Ext.data.Store
Upvotes: 1
Reputation: 1
try store.sync();
If this won't help try to load the data with
store.loadRawRecords([records],true);
Or another approach is to hold the data in an array and load it from there instead from other stores
Upvotes: 0
Reputation: 11
Listen to the beforeload event, return false to block automatic loading, and call Ajax to get the required data.
Upvotes: 0