MVVM numerictextbox spin event doesn't update model

1 Answer 65 Views
NumericTextBox
Jay
Top achievements
Rank 2
Iron
Iron
Veteran
Jay asked on 11 May 2022, 07:55 PM
It seems like the spin event doesn't update the model. Is this intentional? The numeric text box knows its updated value, but it doesn't update the model until  you press enter after using the arrow buttons (or arrow keys) to change the value. You can see what I mean here.

1 Answer, 1 is accepted

Sort by
0
Accepted
Nikolay
Telerik team
answered on 16 May 2022, 12:09 PM

Hello Jay,

The NumericTextBox is designed to update its value only when the input is blurred out. Even if the user inputs a value with the numeric keypad the value will be only updated when enter is hit or the focus is moved out from the widget.

To overcome this you could manually trigger the change event in the spin event handler:

onSpin: function(e) {
            e.sender.trigger("change");
            kendoConsole.log("model: " + this.get("selectedNumber"));
            var ntb = $("#foo").getKendoNumericTextBox();
            kendoConsole.log("spin numerictextbox: " + ntb.value());  
          } 

Let me know if you have any questions.

Regards,
Nikolay
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
NumericTextBox
Asked by
Jay
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Nikolay
Telerik team
Share this question
or