Using jQueryUI datepicker in KendoUI grid

3 posts, 1 answers
  1. Wanchang
    Wanchang avatar
    10 posts
    Member since:
    Jul 2015

    Posted 11 May 2016 Link to this post

    I have used KendoUI grid in my web application. It runs at batch editing mode(incell edit), and there are date columns 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 the jquery date picker shown in cell, 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 set the format as "yyyy/mm/dd".But when I focus in the cell, the string "Wed Jun 17 2015 15:00:00 GMT+0900 (東京 (標準時))" will be displayed.
    How can I control the value displayed in datepicker when I focus in cell ?

    Best regards

  2. Answer
    Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 12 May 2016 Link to this post

    Hello Kiriya,

    For some reason the jQuery UI DatePicker is not able to format a Date object that is passed from the model object. My suggestion is to set the value of the input to the formatted value as shown in the http://dojo.telerik.com/IZaCu example. 

    Regards,
    Boyan Dimitrov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Wanchang
    Wanchang avatar
    10 posts
    Member since:
    Jul 2015

    Posted 13 May 2016 Link to this post

    Hi Boyan 

    Thank you for your workaround.

     

Back to Top