Author Topic: date selected from datepicker in format dd/mm/yy not binding in the grid  (Read 1571 times)

Digitalsoft

  • Pro OEM
  • Newbie
  • *
  • Posts: 49
    • View Profile
Hi Paramquery,
I have a column which is of type date  & it is editable, we initialized the column editor as per in the documentation, just provided the format as "dd/mm/yy" for the column as well as "dateFormat" attribute in the datepicker, The issue here is i can select a date from the datepicker but when focus out the editor the selected date is not binding in the grid cell. I have put the value in the console, it is "undefined". Please find the attachements for better clarity.

« Last Edit: July 13, 2021, 04:29:45 pm by Digitalsoft »

Digitalsoft

  • Pro OEM
  • Newbie
  • *
  • Posts: 49
    • View Profile
Re: date selected from datepicker in format dd/mm/yy not binding in the grid
« Reply #1 on: October 06, 2021, 09:06:00 pm »
Hi Paramquery, any update on this issue?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: date selected from datepicker in format dd/mm/yy not binding in the grid
« Reply #2 on: October 07, 2021, 10:01:10 am »
Please check this example: https://paramquery.com/pro/demos/editing_custom format: 'dd/mm/yy' can be used for OrderDate column.

Point to be noted is that editor.getData has to be implemented to convert from column format into native js 'mm/dd/yy' format.

Code: [Select]
editor: {
     type: 'textbox',
     init: dateEditor,
     getData: function (ui) {
         //convert from column format to native js date format "mm/dd/yy"
         var dt = $.datepicker.parseDate(ui.column.format, ui.$cell.find("input").val());
         return $.datepicker.formatDate("mm/dd/yy", dt);
     }
 },