Time picker time field type

4 posts, 0 answers
  1. Jan Kaare
    Jan Kaare avatar
    16 posts
    Member since:
    Dec 2010

    Posted 14 Apr 2013 Link to this post

    For a grid field set to time, the UI timepicker should appear by default, like the datepicker does for grid field date.

    How to let a timepicker appear?
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 16 Apr 2013 Link to this post

    Hello Jan Kaare,

    There is no such time type for the model. The supported ones are :

    {Number|String|Boolean|Date} default is String

    like noted in the documentation for the schema:

    http://docs.kendoui.com/api/framework/datasource#configuration-schema.model

    If you want to create custom editor template you should specify it like this:

    $productName = new \Kendo\UI\GridColumn();
    $productName->field('TheFieldName')
                ->editor('foo')
                ->title('Product Name');
     
    <!-- where foo is the name of the JavaScript function which will initialize your widget such as TimePicker -->
     
    <script>
        function foo(container, options) {
            $('<input data-bind="value:' + options.field + '"/>')
                .appendTo(container)
                .kendoTimePicker();
        }
    </script>



    Kind regards,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET AJAX banner
  4. Jan Kaare
    Jan Kaare avatar
    16 posts
    Member since:
    Dec 2010

    Posted 17 Apr 2013 Link to this post

    Thanks for this clarification on how to implement a grid cell timepicker.

    The timepicker is now implemented.

    However, I experience problems with the timepicker usage.

    Within mySQL database the field is set to type time.

    Within the grid, the DataSourceSchemaModel field type is set to date.

    For the culture nb-NO utilization, for which the javascript sets .kendoTimePicker({ culture: "nb-NO" }) and the PHP wrapper sets $GridColumn->format("{0:HH:mm}");, when time 14:00 as an example is selected, in the grid cell it first looks ok as the field displays this time being set. The resulting time value in database however ends up as 00:20:13, and when the page and grid are then reloaded, the time field value is gone and comes up blank (no value). I guess this resulting database value 00:20:13 represents the year 2013?

    When mySQL database field is set to type datetime instead, the resulting time part in database ends up as GMT corrected that means 2 hrs correction for the Norwegian summer time. I would believe that when 14:00 is selected in timepicker, it would end up as 14:00 in database and not as 12:00. For this case also, when the page and grid are then reloaded, the time field value is gone and comes up blank (no value).

    Do you have any experience with similar strange date related things like these?
  5. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 19 Apr 2013 Link to this post

    Hello Jan,

    Not exactly sure what is the case with the PHP wrappers -  I assume the problem is because the datetime JavaScript objects are always created with the offset of the browser. Similar question is covered here, it might point you in the right direction.

    http://stackoverflow.com/questions/948532/how-do-you-convert-a-javascript-date-to-utc


    Kind Regards,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top
UI for ASP.NET AJAX banner