Is it possible to configure the kendo numeric textbox that my bound view model will receive an update when i click on the spin or change the numbers with keys? At the moment, only if the numeric text box lose the focus my view model will receive the update event.
The kendo databinding option data-value-update ... has sadly no effect on numeric text boxes
Thanks for any help
I know it's kinda late but here is my solution:
var numericBox = $("#yournumericinput").data("kendoNumericTextBox");
.
.
.
numericBox.element.on("keyup", function (e) {
var newValue = e.target.value;
numericBox.value(newValue);
numericBox.trigger("change");
});
That way the change
event gets triggered immediately after the user has entered a new value, without having to wait for the blur
event. Data validation checks are removed for brevity, but I advise you perform those as well.
And you could also bind the spin
listener to trigger the change
event.
numericBox.bind("spin", function (e) {
this.trigger("change");
});
You can try the below code. It works for me.
ViewModel
viewModel.bind("change", function (e) {
console.log("property Changed on spin ");
});
Razor code
<input id="tbSlideDuration" data-role="numerictextbox"
data-format="#"
data-min="1"
data-max="100"
data-bind="value:slideDuration, events: {spin:change}" />
this will call the change event under the hood :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With