开发者

JQGrid filterToolbar

I have been stuck on this problem for past 2 days. Did lot of googling but was not able to find the exact answer.

Following is the JQGrid definition

$("#tblresults").jqGrid({
            datastr: data,
            datatype: 'jsonstring',
            height: 230,
            colNames: colNames,
            colModel: colModel,
            rowNum: -1,
            viewrecords: true,
            loadComplete: function() {
                ChangeSi开发者_Go百科ze('#tblresults', 70);
            }
        });

And this is the filter definition

    $("#tblresults").filterToolbar({ searchOnEnter: true, stringResult: true, defaultSearch: "cn", groupOp: "AND" });

I get the data from a simple getJSON call. But when I try to use the filter nothing works. I debugged a the code and found out that jqgrid internally calls the reloadgrid, which makes the data to disappear.

Can anyone tell me how can we do filtering in jqgrid completely on client. I am using v3.8 and I learnt that jqgrid v3.7 had this client side filtering logic in place.

Thanks in Advance


Do you have the data First of all you should not use -1 as the value of rowNum. Instead of that use any reliable value like rowNum:1000. More better would be to use local data paging. In the case you should just set for example rowNum:10, rowList:[5,10,20,100].

If you get the input parameters colNames, colModel and data parameters of jqGrid from the server per ajax call you should additionally consider to use data parameter instead of datastr. In the case the datatype should be changed from 'jsonstring' to 'local'.

Some other common parameters like gridview:true and height:'100%' can be also usefull for you. The first one (gridview:true) just improve the performance without any disadvantages and the second (height:'100%') will follow to choosing of the optimal grid height without the vertical scroll bar. It can be good combined with the local data paging (parameters like rowNum:10, rowList:[5,10,20,100]).


add these parameters and your toolbar search should work. i have faced similar problem too when started with jqgrid.

search:true,
loadonce:true,
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜