View Full Version : Loading of Nested Store with Filter attribute

13 Mar 2012, 8:30 AM
I am trying to load a nested model store.

Store A has nested Store B

Store A is loaded and a filter is applied on it.

Now I want to Load store B with the filtered records

I am trying to hack this with following logic. The logic works But this solution seems to be unscalable

Please suggest if there is alternative approach to load the nested stored with filter.

Is there a simple API which can avoid iteration over each record

//On Load of A Store callback
onAStoreLoad : function(records, operation, successful) {
//Load nested B Store
var myBstore = this.getGetBStore();
//get the filer of AStore
var myfilterfeature = operation.filters[0].value;
// Now iterate over all the Recores of Store A
Ext.each(records, function(rec, index) {
//Check if the filter is matching if yes load the recored
if (rec.get('filterdid') == myfilterfeature) {

13 Mar 2012, 10:33 AM
i dont think theres an api that wont iterate over the records but im not 100% sure.
if you worry bout scalability then think that Store A wont go to 1000+ records because net speed and client memory and other stuff, is you expect reaching those numbers then the operation should be made in the server side and from the client just send the operation to be made.
if Store A wont go that big then iterating over it shouldnt be a problem.
Also maybe you can change the solution to your problem, if you describe what you are trying to do with Store B maybe theres another way to do that, instead of copy records from A.

(bad english :d)