osama yaccoub
osama yaccoub

Reputation: 1866

How to use custom date picker to filter data in 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(); }

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.

enter image description here

Upvotes: 0

Views: 1248

Answers (2)

Laymond
Laymond

Reputation: 13

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。

Upvotes: 1

Tony Tomov
Tony Tomov

Reputation: 3277

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)

Upvotes: 0

Related Questions