DatePicker Enabled Property having no effect

4 posts, 0 answers
  1. Alon
    Alon avatar
    18 posts
    Member since:
    Aug 2015

    Posted 06 Mar Link to this post

    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

  2. Georgi
    Admin
    Georgi avatar
    476 posts

    Posted 08 Mar Link to this post

    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.
  3. Alon
    Alon avatar
    18 posts
    Member since:
    Aug 2015

    Posted 08 Mar in reply to Georgi Link to this post

    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

  4. Georgi
    Admin
    Georgi avatar
    476 posts

    Posted 11 Mar Link to this post

    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.
Back to Top