Pergunta

I have a problem with statefull grid. I do not want to save the sort state but I do want to save all other options (column position, column width, grouping etc.)

For now I have tried this with stateEvents option, but it saves whole state of grid when the even fires.

Is there any option to exclude sort state from saving??

Part of the grid config:

this.gridPanel = new Ext.grid.GridPanel({
                id:'grid'+this.id,
                region:region,
                layout:'fit',
                stateful:true,
                stateEvents: ['columnmove', 'columnresize', 'groupchange', 'bodyresize'],
                loadMask:true,
                split:true,
                store: this.stores['root'+this.id],
                cm: this.getRootColumnModel(),
                sm: this.getRootSelectionModel(),
Foi útil?

Solução

You can simply override grid's applyState method (and delete sort state in it):

this.gridPanel = new Ext.grid.GridPanel({
    // ...,
    // ...,
    applyState: function(state) {
        if (state) {
            var newState = Ext.apply({}, state);
            delete newState['sort'];
            Ext.apply(this, newState );
        }
    },
    // ...
});

Outras dicas

This is not my solution, appears to have come from the Sencha support team, the example works.

https://fiddle.sencha.com/#fiddle/dlc

http://www.sencha.com/forum/showthread.php?294920

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top