Filter jqGrid Data by Date Range?

China☆狼群 提交于 2019-12-08 04:07:45

问题


I am trying to filter the jqGrid data by date range - that is, by "dateFrom" and "DateTo". Once the date is selected, I have tried to implement:

var dateFilter = {
                groupOp: "AND",
                rules: [
                { "field": "date", "op": "ge", "data": dateFrom },
                { "field": "date", "op": "le", "data": dateTo }
            ]
            }

    jQuery('#' + gridId).jqGrid('setGridParam', {

        postData: {
            filters: JSON.stringify(dateFilter)
        }
    }).trigger("reloadGrid");

But this doesn't seem to work ? I am using ASP.NET MVC but had hoped to do this on the client side by simply filtering the data to between the selected dates ?

Can anyone assist ?


回答1:


If I understand you correct the old demo from the answer and another demo from the answer will gives you code fragments which you need. Here you could find additionally examples how to construct the filters dynamically.



来源:https://stackoverflow.com/questions/6266048/filter-jqgrid-data-by-date-range

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!