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

Time picker time field type

3 Answers 176 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jan Kaare
Top achievements
Rank 2
Jan Kaare asked on 14 Apr 2013, 09:15 PM
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?

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 16 Apr 2013, 04:34 PM
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!
0
Jan Kaare
Top achievements
Rank 2
answered on 17 Apr 2013, 10:52 PM
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?
0
Petur Subev
Telerik team
answered on 19 Apr 2013, 11:21 AM
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!
Tags
Grid
Asked by
Jan Kaare
Top achievements
Rank 2
Answers by
Petur Subev
Telerik team
Jan Kaare
Top achievements
Rank 2
Share this question
or