1. #1
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    204
    Answers
    3
    Vote Rating
    1
    marxan is on a distinguished road

      0  

    Default Answered: Waiting message while removing records of a grid

    Answered: Waiting message while removing records of a grid


    Hello,

    I want to add a waiting message while I remove records from my grid.

    Code:
    removeRecord: function (c,record,index,e){
    		myGrid = Ext.getCmp('metrSeriesGridId');
    		myGrid.setLoading("Loading");
    
                   var store = Ext.getStore('NrrSeriesStore');		
                   var toRemove = [];			store.each(function (record) {
    			   if (record.get('CODEFC') === valueToRemove) {
    			       toRemove.push(record);
    			   }
    			});
    			store.suspendEvents();
    			store.remove(toRemove);
    			store.resumeEvents();
    			
    			myGrid.getView().refresh();
    
                    myGrid.setLoading(false);
    If I leave the code like this, nothing happen.
    If I remove the setLoafing(false); then I see the waiting message but it doesn't dissapear.

    It also seems that the loading message comes only after I removed the records...

    Anyone could help me?

    Thanks

  2. Replace
    store.sync({
    callback: function () {
    el.unmask();
    }
    });
    with:

    Ext.Function.defer(function(){ el.unmask();},100);

  3. #2
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    247
    Answers
    44
    Vote Rating
    42
    redraid has a spectacular aura about redraid has a spectacular aura about redraid has a spectacular aura about

      0  

    Default


    Try this:
    Code:
    removeRecord: function (c,record,index,e){
      var myGrid = Ext.getCmp('metrSeriesGridId'),
            el = myGrid.getEl();
    
    // show mask
    el.mask('Removing records...');
    
                   var store = Ext.getStore('NrrSeriesStore');  
                   var toRemove = [];   store.each(function (record) {
          if (record.get('CODEFC') === valueToRemove) {
              toRemove.push(record);
          }
       });
       
       store.suspendEvents();
       store.remove(toRemove);
       store.resumeEvents();
       store.sync({
           callback: function () {
               el.unmask();
           }
       });

  4. #3
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    204
    Answers
    3
    Vote Rating
    1
    marxan is on a distinguished road

      0  

    Default same problem

    same problem


    Still the same problem, if I remove the callback function I see the message but it doesn't dissapear If I leave it no message appears.

  5. #4
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    247
    Answers
    44
    Vote Rating
    42
    redraid has a spectacular aura about redraid has a spectacular aura about redraid has a spectacular aura about

      0  

    Default


    Replace
    store.sync({
    callback: function () {
    el.unmask();
    }
    });
    with:

    Ext.Function.defer(function(){ el.unmask();},100);

  6. #5
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    204
    Answers
    3
    Vote Rating
    1
    marxan is on a distinguished road

      0  

    Default


    It works.

    Thanks

Thread Participants: 1