如果我在网格上有数据存储,那么:
store = Ext.create('Ext.data.Store', {
fields: [{
name: 'id'
}, {
name: 'filename'
}
// other fields here ...
],
proxy: {
type: 'ajax',
url: 'http://myniftyurl.com/blah',
simpleSortMode: true,
reader: {
type: 'json',
totalProperty: 'total',
root: 'result'
},
extraParams: {
'limit': Ext.get('itemsPerPage').getValue(),
'to': Ext.get('to_date').getValue()
// other params
}
},
model: 'Page',
remoteFilter: true,
remoteSort: true
});
'limit'和'to'值将根据用户输入而改变,其中存在问题。数据存储使用原始参数而不是新输入。我该如何解决这个问题?
提前致谢!
答案 0 :(得分:2)
我通常通过在控制器中执行store.load()手动加载我的网格。
在此之前,我可以像这样更改商店的参数:
//getForm() retrieves the Ext.basic.Form (from Ext.panel.Form)
var params = this.getForm().getValues();
//Write over
grid.getStore().getProxy().extraParams = params;
//load
grid.getStore().load();
我正在使用缓冲网格,需要大量的返工才能在4.0.7中完全正常工作。但这应该对你有用。
另一个选择是使用beforeload
监听器,但我不确定到那时更改extraParams会做什么。您可以修改传递给事件处理程序的Ext.data.Operation对象吗?
让我知道这对你有用。
祝你好运!