【问题标题】:extjs stateful grid remove sortextjs 有状态网格删除排序
【发布时间】:2011-11-01 01:48:18
【问题描述】:

我对全状态网格有疑问。我不想保存排序状态,但我想保存所有其他选项(列位置、列宽、分组等)

目前我已经尝试使用 stateEvents 选项,但它会在偶数触发时保存整个网格状态。

是否有任何选项可以将排序状态排除在保存之外??

部分网格配置:

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

【问题讨论】:

    标签: gridview extjs stateful


    【解决方案1】:

    您可以简单地覆盖网格的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 );
            }
        },
        // ...
    });
    

    【讨论】:

      【解决方案2】:

      这不是我的解决方案,似乎来自 Sencha 支持团队,示例有效。

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-02-12
        • 2011-10-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-07-24
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多