2
votes

I am trying to save state of grid columns,

I set

Ext.state.Manager.setProvider(new Ext.state.CookieProvider());

and configured grid with

stateful: true,
stateId: 'uniqueGridId',

Right now it saves everything about grid, even I do not have stateEvents.

How do I save only column hide / show state? I tried

initStateEvents : function(){
this.colModel.on('hiddenchange', function(){ this.saveState; });
}

but nothing chages...

Anyway to save hide /show column state and only hide /show column state?

1

1 Answers

3
votes

If somebody need it:

 applyState: function(state) {
                        var cs = state.columns;
                        if (cs.length !== 0) {
                            for (var i = 0, len = cs.length; i < len; i++) {
                                var s = cs[i], c = Ext.getCmp(s.id);
                                if (typeof c !== "undefined") {
                                    if (typeof s.hidden !== "undefined") {
                                        c.hidden = s.hidden;
                                    }
                                }
                            }
                        }
                    },