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

Kendo MVVM NumericTextBox Css binding

1 Answer 137 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Neeraj
Top achievements
Rank 1
Veteran
Neeraj asked on 30 Nov 2018, 07:14 AM
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

1 Answer, 1 is accepted

Sort by
0
Preslav
Telerik team
answered on 03 Dec 2018, 10:50 AM
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.
Tags
MVVM
Asked by
Neeraj
Top achievements
Rank 1
Veteran
Answers by
Preslav
Telerik team
Share this question
or