[英]Reload Next JSON Data Grid ExtJS with Value from Ext Form
我正在嘗試通過分頁從ExtJS創建網格數據視圖。
實際上,當我創建一個簡單的數據網格時沒有問題。
然后,我想使用Ext Form創建一個“過濾/搜索”功能。
僅適用於第一頁。 這是我的Ext表格代碼如下:
var winFilter = Ext.create('widget.window',{
title : 'Filter',
width : 400,
height : 200,
modal : true,
closeAction : 'hide',
items : frmFilter,
layout : 'fit',
bodyPadding: 5,
buttons:[
{
text : 'Filter',
handler: function(btn){
var win = btn.up('window');
var form = win.down('form');
tempProductID = form.getForm().findField('Product_ID').getSubmitValue();
tempDescription = form.getForm().findField('Description').getSubmitValue();
store.load({
params: {
start: 0,
limit: itemsPerPage,
productid: form.getForm().findField('Product_ID').getSubmitValue(),
description: form.getForm().findField('Description').getSubmitValue()
}
});
winFilter.hide();
}
},
{
text : 'Close',
handler: function(){
winFilter.hide();
}
}
]});
對於下一頁,我的JSON返回所有數據,而不使用之前使用的過濾值(產品ID和描述)。
如果有任何建議請
謝謝芽。
params
(當用作load
方法的參數時)僅應用一次。 如果要將這些參數應用於每個請求,則必須修改proxy
extraParams屬性:
Ext.apply(store.proxy.extraParams, {
productid: form.getForm().findField('Product_ID').getSubmitValue(),
description: form.getForm().findField('Description').getSubmitValue()
}, {});
store.load();
另外,您可以使用商店過濾器方法(將store.remoteFilter設置為true):
store.filter([
{property: "productid", value: form.getForm().findField('Product_ID').getSubmitValue()},
{property: "description", value: form.getForm().findField('Description').getSubmitValue()
]);
但是請注意,使用過濾filter
方法時,請求url的過濾器部分具有不同的形式。 在這種情況下,過濾器部分看起來類似於?filter=[{'property':'productid','value':2}]&limit=10...
而使用params
方法時,url看起來類似於?productid=2&limit=10...
因此,當使用filter
方法時,后端應解析請求的filter
屬性。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.