选择"jQuery日期选择器"后重新加载JQGrid [英] Reload a JQGrid after Jquery Date Picker selection

查看:143
本文介绍了选择"jQuery日期选择器"后重新加载JQGrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的ASP.NET项目之一中使用JQGrid,其中网格显示可排序/可过滤的项目列表(一切正常)

I am using a JQGrid in one of my ASP.NET projects where the grid shows a list of items that are sortable/filterable (That's all working fine)

我唯一遇到的问题是,其中一列是日期字段,所以我有一个使用日期选择器(使用以下选项)的过滤器文本框

The only problem im having with it is, one of the columns is a date field so I have the filter textbox using the date picker (using the below options)

{ name:'Due',
  index:'Due', 
  width:100, 
  align:"center",
  searchoptions:{
      dataInit:function(el){
          $(el).datepicker({dateFormat:'dd-mm-yy'});
      }
   }
 }

但是,当我从日期选择器中选择一个日期时,它并不会自动刷新网格(如下拉菜单一样),我必须再次单击文本框,然后按Enter.

But when I select a date from the date picker it's not refreshing the grid automatically (like the dropdowns do) I have to click the textbox again and press enter.

有没有办法解决这个问题?

Is there a way to fix this?

jqGrid 3.5 beta

jqGrid 3.5 beta

推荐答案

我没有使用过JQGrid,但是从文档中您应该可以执行以下操作:

I haven't used JQGrid, but from the documentation you should be able to do something like this:

{
    name:'Due',
    index:'Due', 
    width:100, 
    align:"center",
    searchoptions:{
        dataInit:function(el){
            $(el).datepicker({
                dateFormat:'dd-mm-yy',
                onSelect: function(dateText, inst){ $("#grid_id")[0].triggerToolbar(); }
            });
        }
    }
}

不要忘记将#grid_id更改为与您的网格匹配的选择器.

Don't forget to change the #grid_id to the selector that matches your grid.

已更新:将$("#grid_id").trigger("reloadGrid");更改为$("#grid_id")[0].triggerToolbar();.在 jqGrid 3.5b演示中对此进行了测试.

Updated: Changed $("#grid_id").trigger("reloadGrid"); to $("#grid_id")[0].triggerToolbar();. Tested this on the jqGrid 3.5b demos and it works.

这篇关于选择"jQuery日期选择器"后重新加载JQGrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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