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

DatePicker Enabled Property having no effect

3 Answers 47 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Alon
Top achievements
Rank 1
Veteran
Alon asked on 06 Mar 2019, 10:44 AM

I have the following code in my HTML template

 

<div class="form-group col-xs-6">
    <label for="txtDiscountFrom">Available From</label>
   <input class="form-control k-input-lg" data-role="datepicker"
data-bind="enabled:editorModel.onlineEnabled, value:editorModel.discountFrom"
name="txtDiscountFrom" id="txtDiscountFrom" placeholder="Enter From Date"
data-required-msg="Enter From Date"/>
</div>

 

As you can see I have bound editorModel.enabled to the enabled property. I have other INPUT fields on this form (not shown) which are also bound to this field and they are enabled/disabled correctly. However, the 2 datePicker fields I have seem to ignore this property. They always stay enabled. Does DatePicker not support the enabled property? 

Interestingly enough if I remove the data-role="datepicker" from the above HTML the enabled binding works! Is there something specific on datepicker that I should be doing instead?

I am running Kendo 2019.1.115

3 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 08 Mar 2019, 08:13 AM
Hello Alon,

I have tested the enabled binding of the date picker using the 2019.1.115 version and it seems to work as expected on my end. Below you will find the sample I used for testing. Could you please examine it and let me know what I am missing?



Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Alon
Top achievements
Rank 1
Veteran
answered on 08 Mar 2019, 01:14 PM

Thanks Georgi. The demo you provided does indeed work perfectly and I cannot see how it is different to mine. Anyway, its probably something I am missing in my code.

I ended up getting around the issue but explicitly calling the readOnly method on the datePicker. It seemed to work without a problem.

 

https://docs.telerik.com/kendo-ui/api/javascript/ui/datepicker/methods/readonly

Regards,

Alon

0
Georgi
Telerik team
answered on 11 Mar 2019, 07:32 AM
Hello Alon,

A common cause for the described behavior is when the field is misspelled. Could you please that there are no typos and the field is exists within the model?

If none of the above is the case, please ensure there are no js errors in the console of your browser.

Having said that, sharing a demo that clearly replicates the issue would definitely help us fully understand the case and we will be able to provide further assistance to the best of our knowledge.
 

Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Date/Time Pickers
Asked by
Alon
Top achievements
Rank 1
Veteran
Answers by
Georgi
Telerik team
Alon
Top achievements
Rank 1
Veteran
Share this question
or