I’m trying to add a Datepicker filter on a JQGrid toolbar. When I click on the date filter, no problem the Datepicker shows up, but when I select my date, nothing happen. The date I’ve chose doesn’t appear in the toolbar filter and of curse no search is launch.
Did I miss something?
Here is my code:
colModel: [
{ name: 'Period', index: 'Period', align: 'left', formatter: 'date',
search: true,
searchoptions: {
dataInit: function (el) {
$(el).datepicker({
changeYear: true,
changeMonth: true,
showButtonPanel: true,
dateFormat: 'dd-mm-yy',
onSelect: function(dateText, inst) {
$("#grid_id")[0].triggerToolbar();
}
});
}
}}
]
Thanks in advance for your help!
The problem with the searching toolbar is that the code from
onSelectcallback could be executed too early. So you should start the code in another thread and allow the current work be done till the end:The test for
idof the current<input>field I inserted to be sure that we don’t try to usetriggerToolbarin searching dialog. I mean that one can combine searching toolbar for simple searching with advanced searching for more complex searching requests.