Nov 15, 2011, 5:03 AM
[CLOSED] Store: How to stop Store.Each loop?
Hi,
I have 2 stores (via 2 gridpanel). The stores can contain 1000 records which when iterated, causes browser warning about "Stop running this script?" error. So I intend to limit the number of iterations. Is it possible to stop the "gridLeft.store.each" loop with a given number of records?
I have 2 stores (via 2 gridpanel). The stores can contain 1000 records which when iterated, causes browser warning about "Stop running this script?" error. So I intend to limit the number of iterations. Is it possible to stop the "gridLeft.store.each" loop with a given number of records?
var recs = [];
var countx = 0;
gridLeft.store.each(function (record, index) {
if(record.data.ShowTest == true){
rec = new entityRight({
"ItemCode": record.data.ObservationCode,
"HeaderOID": headerOID,
"DetailOID": 0,
"ItemDescription": record.data.ObservationName,
"LabResultItemOID": record.data.ObservationOID,
"SortIndex": sortIndex++
});
recs.push(rec);
record.set('ShowTest', false);
countx++;
}
if(countx > 100); //Exit the store.each loop
});
gridRight.store.add(recs);
gridRight.store.commitChanges();
Last edited by Daniil; Nov 15, 2011 at 5:33 AM.
Reason: [CLOSED]