How to use custom date picker to filter data in jqgrid

无人久伴 提交于 2019-12-25 09:28:50

问题


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(); }

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.


回答1:


You want to get this picture's result? use bootstrap-datetimepicker.js resutl

I did this use code :

{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
                                }); 
                          },
                    }

you can use your date plugin in dataInit callback function。




回答2:


In all cases in order to get answer of your problem you will need to provide more information about this datepicker component - I mean detailed description of parameters, can this component be used with jquery bind function and etc.

By example you say

datePick("field_to_fill_with_date_picked", this,"form_name")

What mean field_to_fill_with_date_picked - is this id or the name in the form.

You may want to look at Guriddo jqGrid Knowledge Base and get idea how to trigger a search when selecting a date (using jQuery UI datepicker)



来源:https://stackoverflow.com/questions/44997340/how-to-use-custom-date-picker-to-filter-data-in-jqgrid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!