0

I had a jqGrid and I had put a datepicker on the search column. When I click the datepicker, it come out and allow me to choose any date I want. However, after date selection it wont help me to filter my result. But if I type the same date on the column jqGrid will do the filtering for me.

Here is my code.

{name:columnArr4[3], index:columnArr4[3], width:106, sortable: true, fixed:true, resizable:false, // expiry date
            formatter: function (cellvalue, options, rowObject) 
            {
                celVal = '-';
                if (cellvalue && cellvalue.replace(/\s/g, '').length>0){
                    celVal = cellvalue;
                }
                return celVal;
            },
            search:true, stype:'text', searchoptions: {      dataInit: function(el) {
                            $(el).datepicker({
                                dateFormat: 'yy-mm-dd'
                            });
                        }
                    }
        },
n3ISe
  • 159
  • 1
  • 2
  • 16

1 Answers1

0
dataInit: function (elem) {
$(elem).datepicker({
    changeYear: true,
    changeMonth: true,
    showButtonPanel: true,
    onSelect: function() {
        if (this.id.substr(0, 3) === "gs_") {
            // in case of searching toolbar
            setTimeout(function(){
                myGrid[0].triggerToolbar();
            }, 50);
        } else {
            // refresh the filter in case of
            // searching dialog
            $(this).trigger('change');
        }
    }    
});
}
n3ISe
  • 159
  • 1
  • 2
  • 16
  • 1
    Is it not the same code which I posted [here](http://stackoverflow.com/a/6876951/315935) and [here](http://stackoverflow.com/questions/13007373/how-do-make-datepicker-onselect-function-works-differently-in-toolbar-search-and/13009927#13009927)? – Oleg May 29 '13 at 05:37
  • @Oleg ya...i found you answer. So I post again..but sorry that I forget to tag u juz now – n3ISe May 29 '13 at 05:57