我们有一个简单的网格设置,由缓冲商店提供。但是如果我们在商店调用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);
}
});
答案 0 :(得分:0)
我遇到了类似的问题,我的过滤器没有应用,重新加载后你可以试试。
grid.getStore().loadPage(grid.getStore().currentPage);