如何基于过滤器选项重新加载JQGrid?

时间:2022-07-23 14:30:22

I have a JQgrid, By default this will display all data's(say All, xxx, yyy, zzz). I have a filter drop-down, by default with "All" selected. If I change to xxx, it should call a function by passing "xxx" to call a struts action. Based on the action's return value (JSON data) the jqgrid should populate again with the new data. As of now, It is calling "All" even I select "xxx". How to achieve this?

我有一个JQgrid,默认情况下会显示所有数据(例如All,xxx,yyy,zzz)。我有一个过滤器下拉列表,默认情况下选中“全部”。如果我改为xxx,它应该通过传递“xxx”调用一个struts动作来调用一个函数。根据操作的返回值(JSON数据),jqgrid应该再次使用新数据填充。截至目前,即使我选择“xxx”,它也会调用“全部”。怎么做到这一点?

1 个解决方案

#1


0  

You can Try out some thing like this. This function reloads your jqGrid.

你可以试试这样的事情。此函数重新加载您的jqGrid。

$("[#TableId]").jqGrid('GridUnload');

jQuery("[#TableId]").jqGrid({
    url: "........html",
    datatype: "json",
    jsonReader : {
        root : "rootObjlst",
        page : "page",
        total : "total",
        records : "records",
        repeatitems : false
    } ,

#1


0  

You can Try out some thing like this. This function reloads your jqGrid.

你可以试试这样的事情。此函数重新加载您的jqGrid。

$("[#TableId]").jqGrid('GridUnload');

jQuery("[#TableId]").jqGrid({
    url: "........html",
    datatype: "json",
    jsonReader : {
        root : "rootObjlst",
        page : "page",
        total : "total",
        records : "records",
        repeatitems : false
    } ,