This is a migrated thread and some comments may be shown as answers.

Is there a way to set the format for a DatePicker column inside of a grid?

3 Answers 268 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 18 Jun 2013, 01:11 AM
I know that DatePicker has a format attribute (http://docs.kendoui.com/api/web/datepicker#configuration-format).

But what if I had a grid with a date column. Can I set the format of the DatePicker that is used here in edit mode?

By the way, I am using fluid syntax.

3 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 18 Jun 2013, 10:34 AM

Hello Patrick,

In order to format the date column in your grid, you can set the columns.format property. The format will be passed to the default DatePicker editor. For example:

columns: [{
    field: "date",
    format: "{0: yyyy-MM-dd}"
}]


Regards,
Kiril
the Telerik team

Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!

0
Larissa
Top achievements
Rank 1
answered on 03 Mar 2016, 05:15 PM

This does not work. If I set the format on the column, the grid column displays the date in te right format. But if I edit this cell, the datePicker shows up with no format.

I want to use only the year part of my date, so I format the column like this:

columns: [{
            title: "Date",
            field: "date",
            format: "{0:yyyy}"
        }]

So only the year is shown on the grid, but the datePicker displays the days and months.

 

Any ideas?

0
Kiril Nikolov
Telerik team
answered on 07 Mar 2016, 08:15 AM
Hello Larissa,

For editing - you can define a custom editor where you can set the format. If you have problems with that - please open a support request and we will be happy to help.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Patrick
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Larissa
Top achievements
Rank 1
Share this question
or