如何使用自定义日期选择器过滤jqgrid中的数据 [英] How to use custom date picker to filter data in jqgrid
问题描述
我们在使用javascript开发的应用程序中有一个自定义的日期选择器组件,我想使用该组件来过滤jqgrid中的列值(即,我希望它替换
We have a custom date picker component in our application developed in javascript , I want to use this component to filter column values in jqgrid (i.e. I want it to replace
dataInit : function (elem) {
$(elem).datepicker();
}
dataInit : function (elem) {
$(elem).datepicker();
}
鉴于自定义组件是这样的,我该怎么做:
How can I do that given that the custom component is like this :
<IMG style="CURSOR: hand" onclick='datePick("field_to_fill_with_date_picked", this,"form_name")' border=0 src="/path/to/calendar/image.gif">
另一个问题:先前的代码实际上无法过滤列中的数据..它看起来如下所示……当我选择列值中存在的日期时,什么也没有发生.
Another question : the previous code is actually not able to filter the data in the column .. it looks like below ... when I choose a date that is present in the column values nothing happens at all.
推荐答案
您想获得这张照片的结果吗? 使用bootstrap-datetimepicker.js结果
You want to get this picture's result? use bootstrap-datetimepicker.js resutl
我使用此代码:
{name:'CREATE_DATE_TIME',label:'创建时间',sortable:true,align:'center',
searchoptions : {
dataInit: function (element) {
$(element).datetimepicker({
minView: 0,
language: 'zh-CN',
format: "yyyy-mm-dd" ,
todayBtn: 1,
autoclose: 1
});
},
}
您可以在dataInit回调函数中使用日期插件.
you can use your date plugin in dataInit callback function。
这篇关于如何使用自定义日期选择器过滤jqgrid中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!