问题
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