简体   繁体   English

extjs有状态网格删除排序

[英]extjs stateful grid remove sort

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. 现在,我已经使用stateEvents选项进行了尝试,但是当偶数触发时,它可以保存整个网格状态。

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(),

You can simply override grid's applyState method (and delete sort state in it): 您可以简单地覆盖网格的applyState方法(并删除其中的sort状态):

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

This is not my solution, appears to have come from the Sencha support team, the example works. 这不是我的解决方案,似乎来自Sencha支持团队,该示例有效。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM