extjs - 带有缓冲存储的缓冲(无限)网格不会在存储重新加载时更新

标签 extjs extjs4 extjs4.2

我们有一个由缓冲存储提供的网格的简单设置。但是,如果我们在商店上调用 reload(),商店会重新加载,但网格不会更新。如果我们调用 load(),所有内容都会更新。我们想调用重新加载,因为我们想保留所有排序器、分组器和过滤器。

这是商店

Ext.define('App.store.User',{
    extend: 'Ext.data.Store',
    requires: ['Ext.data.proxy.Direct'],
    model: 'App.model.User',

    remoteGroup: true,

    autoLoad: true,
    buffered: true,
    pageSize: 50,
    leadingBufferZone: 500,
    trailingBufferZone: 500,
    autoSync: true,

    constructor: function(config) {
        config = Ext.apply({}, config);
        if (!config.proxy) {
            var proxy = {
                type: 'direct',
                reader: {
                    idProperty: 'Id',
                    root: 'data',
                    type: 'json'
                },
                writer: {
                    allowSingle: false
                },
                api: {
                    read: User.List, 
                    create: User.Create,
                    update: User.Update,
                    destroy: User.Delete
                }
            };
            config.proxy = proxy;
        }

        this.callParent([config]);
    }
);

和网格

Ext.define('App.view.grid.User',{
    extend: 'Ext.grid.Panel',
    alias: 'widget.usergrid',

    id: 'user-grid',

    loadMask: true,

    selModel: {
        multiSelect: true,
        pruneRemoved: false
    },
    selType: 'checkboxmodel',
    multiSelect: true,
    viewConfig: {
        trackOver: false
    },
    plugins:[{
        ptype: 'bufferedrenderer',
        trailingBufferZone: 50,
        leadingBufferZone: 50
    }],

    features:[{
        ftype: 'grouping',
        enableGroupingMenu: false
    }],

    constructor: function(config) {
        var editor = {ptype:'rowediting', clicksToEdit: 2};
        config = Ext.apply({}, config);
        if (!config.plugins) {
            config.plugins = [editor];
        } else {
            if(Ext.isArray()) {
                config.plugins.push(editor);
            } else {
                config.plugins = [config.plugins,editor];
            }
        }
        config.store = Ext.StoreMgr.lookup('User');
        this.callParent([config]);
    },

    initComponent: function() {
        var me = this;

        if (!me.store) {
            me.store = Ext.StoreMgr.lookup('User');
        }

        me.columns = [
            {text: 'ID',dataIndex:'Id'},
            {text: 'Client-ID',dataIndex:'Client_id'},
            {text: 'SuperiorId',dataIndex:'Superior_id'},
            {text: 'LastChange',dataIndex:'LastChange',xtype:'datecolumn',format:'d.m.Y'},
            {text: 'UserName',dataIndex:'UserName',editor:{xtype:'textfield'}},
            {text: 'Firstname',dataIndex:'Firstname',editor:{xtype:'textfield'}},
            {text: 'Lastname',dataIndex:'Lastname',editor:{xtype:'textfield'}},
            {text: 'ShortName',dataIndex:'ShortName',editor:{xtype:'textfield'}}
        ];

        me.callParent(arguments);
    }
});

最佳答案

我有类似的问题,我的过滤器没有应用,重新加载后你可以试试。

grid.getStore().loadPage(grid.getStore().currentPage);

关于extjs - 带有缓冲存储的缓冲(无限)网格不会在存储重新加载时更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23238321/

相关文章:

java - iReport 与 extjs4.0.2a 和 Java + Spring + Hibernate 的集成

javascript - Extjs 4.0 中将组合框与一个商店链接起来

extjs - Mootools 和 ExtJs 4.x 好像不兼容,怎么解决?

javascript - ExtJS 以 ISO 8601 格式显示来自服务器的日期/时间

javascript - 什么是 Ext.namespace,我们应该如何使用它们?

javascript - Extjs : url in store

javascript - 如何知道在多选组合框中选择了多少个项目

javascript - maxLength 属性不会阻止字符进入 ExtJS MessageBox.prompt()

带有代理的 extjs treestore

javascript - ExtJS 5 - 带有表单字段错误的链式存储绑定(bind) (MVVM)