Existing date is not populating for datepicker when we use inline edit with Datatable
Existing date is not populating for datepicker when we use inline edit with Datatable
amitmhetre
Posts: 3Questions: 1Answers: 0
It is been observed that, when we change the date format as per our requirement the existing date is not show as selected within datepicker. Instead it is showing current date as selected. Below is my configuration for datepicker inside datatable
{
label: 'Date',
name: 'created_at',
type: 'datetime',
format: 'MM/DD/YYYY',
attr: {
autoComplete: 'off',
placeholder: 'Date',
defaultDate: 0
}
Does anyone know what to do to populate existing date in datepicker by keeping our date format?
Thanks
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Hi @amitmhetre ,
It's hard to recommend without seeing the two date formats. Would you be able to modify this example here to have the two formats, please, and then steps on how to reproduce the problem?
Cheers,
Colin
Hi @colin
From the link which you have shared, I just changed the date format as -
format: 'MM/DD/YYYY'
Please refer link: http://live.datatables.net/wegowafu/26/
Then you can see when we click on any date field from any row, then datepicker with current date as selected is populated. Instead it should auto select the existing date
For eg. When I select the date field with value as '2011/12/12' it should auto select the same date in datepicker. Currently current date is selected by default when datepicker is shown
Please let me know if anything else from my side.
The issue here is that the
format
you are giving doesn't match the format of the data. They need to match - e.g. useYYYY/MM/DD
or change the data format to match the display format you want.Allan
Thanks @allan and @colin
By changing date formats from database (to match with date format we mentioned for datatable) worked for us.
Once again thanks for your quick support.