0
votes

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

2

2 Answers

0
votes

Here's an override I've been using to fix the hidden columns issue. I am using 6.6 so not sure if this will work in 4.4, though. Also, you may not need to suspend/resume layouts but not sure on that either.

Ext.define('MyApp.overrides.Grid', {
            override: 'Ext.grid.Panel',

            applyState: function () {
                this.callParent(arguments);

                Ext.suspendLayouts();
                Ext.each(this.getColumns(), function (column) {
                    if (column.hidden) {
                        column.show();
                        column.hide();
                    }
                });
                Ext.resumeLayouts(true);
            }
    });
0
votes

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.