Reputation: 50728
I have a kendo DateTimePicker plugin (open source) in which it shows times from 12 AM to 11:30 PM. I was wondering, if on clicking the time button, I could start the list at 7:30, instead of the first item of the list at 12:00 AM? Is there a way I can have an initial value not at the first item of list, when no time has been selected?
My default registration:
$("#control").kendoDateTimePicker({
format: "MM/dd/yyyy hh:mm tt",
min: new Date(1900, 1, 1)
});
Upvotes: 1
Views: 2624
Reputation: 3407
There is no simple way to do this :/ But you can still do it ugly but working way, here is the code:
$("#datetimepicker").kendoDateTimePicker({
open: function(e) {
if (e.view === "time") {
var list = $("#"+ e.sender.element.attr('id') + "_timeview");
if(list.attr('fixed-time-labels') != 'true'){
var elements = list.find('li:lt(15)');
elements.insertAfter(list.find('li:last'));
list.attr('fixed-time-labels', 'true');
}
}
}
});
and here is demo in telerik dojo.
If you do not like :lt(15)
you can take culture from kendo.culture() get time format and get li where text == 7:30 AM
in current culture.
Upvotes: 1