JQGrid / Date Picked within Add/Edit window

kilrizzy picture kilrizzy · Aug 7, 2009 · Viewed 31k times · Source

I have been able to work the Date Picker into JQGrid when editing inline, but I am unable to use it inside the add/edit window. Does anyone have instructions on how to do this or an example I can look at?

demo from that site of what I am trying to do: http://www.the-di-lab.com/demo/apples

I read that I could use the following method but not sure how to integrate it:

dataInit : function (elem) {
$(elem).datepicker();
}

Answer

Dimitar Hubenov picture Dimitar Hubenov · Aug 20, 2009

Adding datepicker is an easy task:

colModel: [
  ... other column definitions ...
  {
    name:'my_date', index:'my_date', label: 'Date', width: 80,
    editable: true, edittype: 'text',
    editoptions: {
      size: 10, maxlengh: 10,
      dataInit: function(element) {
        $(element).datepicker({dateFormat: 'yy.mm.dd'})
      }
    }
  },
  ... other column definitions ...
]

Of couse, instead of .datepicker you can use any plugin like colorpicker or autocomplete.