[CLOSED] Store: How to stop Store.Each loop?

  1. #1

    [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?

    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]
  2. #2
  3. #3
    Hi Daniil,

    Sorry for the obvious question. Thanks! Please close this ticket.

    Regards,

Similar Threads

  1. Store.Reload loop
    By mj.daly in forum 1.x Help
    Replies: 3
    Last Post: Oct 25, 2013, 4:38 PM
  2. [CLOSED] Tasks stop running after store.save() is called
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Oct 11, 2011, 9:06 AM
  3. [CLOSED] loop though gridpanel and update store
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 03, 2011, 8:11 AM
  4. [CLOSED] [1.0] How to stop bubbling of store's exception event?
    By jchau in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 24, 2010, 8:25 PM
  5. [CLOSED] Stop tracking store changes
    By danielg in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 12, 2009, 1:49 PM

Posting Permissions