Extjs Gridpanel缓冲渲染器滚动不重置

时间:2015-12-16 06:58:13

标签: extjs

我一直在尝试使用缓冲存储和" bufferedrenderer "来实现缓冲网格面板。 ExtJs 5.1.1的插件。当我加载的内容比以前加载的内容少时,滚动不会重置。我仍然需要向下滚动才能在面板上找到我的内容。内容区域的高度保持为先前内容的高度。如果有人能给我一个建议,我将非常感激。

提前谢谢。

1 个答案:

答案 0 :(得分:1)

We experienced the same when switching from a grid with many elements (+ some scrolling done ) to the same grid with no element. We solved this by overriding Ext.data.Store to throw a clear event when clearData() is called. The clear event triggers a call to onStoreClear() of Ext.grid.plugin.BufferedRenderer. This solved the problem for us.

Ext.define('Ext.data.Store', {
    override: 'Ext.data.Store',

    config: {
        forceClearEventOnLoad: false
    },

clearData: function(isLoad, data) {
    if(this.forceClearEventOnLoad && isLoad) {
        this.fireEvent('clear', this, data);
    }
    this.callParent(arguments);
}

});

Dont forget to set forceClearEventOnLoad:true in your store config.