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

Using jQueryUI datepicker in KendoUI grid

1 Answer 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sync
Top achievements
Rank 1
sync asked on 30 Jun 2015, 01:20 AM

I have used KendoUI grid in my web application. It runs at batch editing mode, and a date column is in the grid.
For some reasons, I can't using KendoUI datepicker to show the date when a cell in the column clicked. Instead,I must use the jQueryUI datepicker in edting mode.
But when I was showing the jquery date picker, the date can not be displayed with the format which I have set.
Following is my configuration.

 

$("#"+currGrid.options.girdContainerId).kendoGrid({
    dataSource: kendoGridDataSource,
    ...
    columns:[
       ...
       {
        field:'StartDate',
        editor : function(container, options){
                var $input = $("<input />").attr("name",options.field).appendTo(container);
                $input.datepicker({
                    dateFormat:"yy/mm/dd",
                });
        },
        format:"{0:yyyy/MM/dd hh:mm:ss}",
        },
        ...
    },
    ,
    editable: true

I have set the format as "yyyy/mm/dd".But when I focus in the cell, the string likes "Wed Jun 17 2015 15:00:00 GMT+0900 (東京 (標準時))" will be displayed.
How can I control the value displayed in datepicker with format as "yy/mm/dd" when I focus in cell first time?
Best regards

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 01 Jul 2015, 03:15 PM
Hello,

I assume that this behaviour is caused by the way jQuery DatePicker works.

In terms of Kendo UI, the editor input will be value-bound to the corresponding field from the edited model. That means Kendo MVVM will set the value of the input to a JavaScript date object. Since the input value attribute does not accept JavaScript Date object it will use its string representation ("Wed Jun 17 2015 15:00:00 GMT+0900 (東京 (標準時))").

Please examine the jQuery DatePicker behaviour - what the widget does with the value attribute, how the widget data should be set and etc.

Regards,
Alexander Valchev
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
sync
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or