0

我正在使用JqgridAsp.net。我正在尝试实现 Toolbar Search 。每个字段都是可搜索的,但日期搜索不起作用。我看到了一些示例,它们正在工作,因为它们使用本地数据和源中的日期格式是2012/02/02. 但是我直接从数据库中获取数据,所以请帮我解决这个问题。

这是我的 Date Col 模块

               name:'Date',
               index:'Date',                                                                                  
               align:"center",
               formatter:'date',                                                                 
               formatoptions: {newformat:'m/d/Y'},                               
               searchoptions: 
               {sopt: ['eq','ne'],
               dataInit : function (elem) {
$(elem).datepicker({ changeYear: true, changeMonth: true,  showButtonPanel: true});
                                        }}
4

1 回答 1

0

sorttype: "date"您应该在列的定义中使用附加属性'Date'。此外,您应该验证服务器是否以正确的格式返回日期值。

如果您仅使用jqGridnewformat的属性,formatoptions请尝试以 ISO 8601 格式读取数据:“Ymd”。如果服务器以另一种格式返回日期,则应srcformat针对formatoptions. 例如srcformat: "m/d/Y".

于 2012-11-05T06:49:07.840 回答