Kendo MVVM NumericTextBox Css binding

2 posts, 0 answers
  1. Neeraj
    Neeraj avatar
    127 posts
    Member since:
    May 2015

    Posted 30 Nov 2018 Link to this post

    Hello, 
                 I have one kendo numeric textbox which is mvvm bind and when value is 0 its color i need to change red. but it seems to not working. Please check this link: https://dojo.telerik.com/EqegiSoJ/2
  2. Preslav
    Admin
    Preslav avatar
    503 posts

    Posted 03 Dec 2018 Link to this post

    Hi Neeraj,

    Due to the complexity of the Kendo UI widgets binding styles/classes in an MVVM scenario is not supported. 

    To achieve the desired outcome, I would suggest handling the change event of the checkbox and manually adding/removing the desired class. For example:

    onCheckboxChange: function(e){
      if(this.important){
        $("#my-ntb").data("kendoNumericTextBox").wrapper.find("input").addClass("important");
      }else{
        $("#my-ntb").data("kendoNumericTextBox").wrapper.find("input").removeClass("important");               
      }
    }

    For a runnable example, check the modified Dojo:
    I hope this helps.


    Regards,
    Preslav
    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