繁体   English   中英

使用Ext表单中的值重新加载下一个JSON数据网格ExtJS

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM