extjsextjs4

Extjs Grid ApplyState not reflecting the changes | Hide issue


When we have multiple parent-child grid and want to re config the grid after load call like this:

listeners: {
     'afterrender': function (grid) {      
      var state =grid.getState();
      state.columns[1].hidden= true;
      grid.applyState(state); 
    }
}

This behaviour is even still reproducable on ExtJS 6.5.1.

For Example https://www.sencha.com/forum/showthread.php?306941-Apply-state-after-grid-reconfigure


Solution

  • Well it's still an issue with applyState. When grid is having multiple hidden columns and we use applyState function it crash our grid. So we have skip the hidden property part although it's working smooth for width change , filters etc.

    listeners: {
         'afterrender': function (grid) {      
          var state =grid.getState();
          state.columns[1].hidden= false;
          grid.applyState(state); 
          grid.columns[3].hidden = true;
        }
    }
    

    if you manually set hidden property of column it'll hide it.