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

Kendo DateTime Picker opens the calendar even while opening the Time selector.

1 Answer 282 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Deb
Top achievements
Rank 1
Deb asked on 29 Aug 2012, 11:34 AM
Hi,

The Kendo DateTimePicker that we are using behaving strangely. On first time load the control behaves as it should and opens the calendar and time selector on their respective select clicks. However, once the user control is reopened, the datetimepicker starts behaving strangely.

The KendoDateTime Picker is bound to one input textbox. On the runtime, the html (working case) looks like this.

<SPAN class="k-picker-wrap k-state-default" jQuery171010970156005264647="31"><br><INPUT style="WIDTH: 100%" id=datetextbox class=k-input value="08/29/2012 04:47 PM" size=22 data-role="datetimepicker" jQuery171010970156005264647="27"><br><SPAN class=k-select unselectable="on"><br><SPAN class="k-icon k-i-calendar" unselectable="on" jQuery171010970156005264647="32">select</SPAN><br><SPAN class="k-icon k-i-clock" unselectable="on" jQuery171010970156005264647="33">select</SPAN></SPAN></SPAN>

However, when I close the user control and reopen it..The calendar starts behaving in an unwanted manner and the time selector when clicked opens the calendar instead. Below is the run time html.

<br><span class="k-picker-wrap k-state-default" jQuery171010970156005264647="62"><br><INPUT style="WIDTH: 100%" id=datetextbox  class=k-input value="08/29/2012 04:52 PM" size=22 data-role="datetimepicker" jQuery171010970156005264647="27"><SPAN class=k-select unselectable="on" jQuery171010970156005264647="63"><SPAN class="k-icon k-i-calendar" unselectable="on" jQuery171010970156005264647="32">select</SPAN><SPAN class="k-icon k-i-clock" unselectable="on" jQuery171010970156005264647="33">select</SPAN></SPAN>

The strange thing here is some jquery functions are being injected and might cause this issue. Has anyone witnessed this behavior and any possible solution for that.

P.S:- The noticeable change is 

Not Working : - 
<SPAN class=k-select unselectable="on" jQuery171010970156005264647="63"> 
Vs Working : - 
<SPAN class=k-select unselectable="on"> 

1 Answer, 1 is accepted

Sort by
0
Yann Struillou
Top achievements
Rank 1
answered on 26 Mar 2013, 04:03 PM
The code that initializes the Kendo DateTimePicker (kendoDateTimePicker method) may be executed many times on the same input control.

Such a code may solve the problem:

var dateTimePickerInput = $('#myDateTimePicker');
var dateTimePickerObject = dateTimePickerInput.data("kendoDateTimePicker");

if (dateTimePickerObject == undefined)
{
    dateTimePickerInput.kendoDateTimePicker( { format: "g" } ); 
    dateTimePickerObject = dateTimePickerInput.data("kendoDateTimePicker");
}
Tags
Date/Time Pickers
Asked by
Deb
Top achievements
Rank 1
Answers by
Yann Struillou
Top achievements
Rank 1
Share this question
or