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

4 posts, 0 answers
  1. Patrick
    Patrick avatar
    12 posts
    Member since:
    Sep 2011

    Posted 17 Jun 2013 Link to this post

    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.
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2596 posts

    Posted 18 Jun 2013 Link to this post

    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!

  3. Larissa
    Larissa avatar
    19 posts
    Member since:
    Dec 2015

    Posted 03 Mar 2016 in reply to Kiril Nikolov Link to this post

    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?

  4. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2596 posts

    Posted 07 Mar 2016 Link to this post

    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!
     
Back to Top