是否按日期范围过滤jqGrid数据? [英] Filter jqGrid Data by Date Range?

查看:53
本文介绍了是否按日期范围过滤jqGrid数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试按日期范围(即"dateFrom"和"DateTo")过滤jqGrid数据.选择日期后,我便尝试实施:

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");

但这似乎行不通吗?我正在使用ASP.NET MVC,但希望在客户端通过简单地将数据过滤到选定日期之间来做到这一点?

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 ?

任何人都可以协助吗?

推荐答案

如果我了解您的要求,请纠正答案的nofollow noreferrer>旧演示 a>和另一个演示 /stackoverflow.com/questions/4973361/how-can-i-preserve-the-search-filters-in-jqgrid-on-page-reload/4977896#4977896>答案将为您提供代码片段你需要. 此处您还可以找到一些示例,以了解如何动态构建filters.

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.

这篇关于是否按日期范围过滤jqGrid数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆