Hi,
I found a strange behaviour of the numerictextbox's change event. If I change the value of the widget from code it doesn't fire the change event:
Is it by design behaviour, or is it a bug?
I found a strange behaviour of the numerictextbox's change event. If I change the value of the widget from code it doesn't fire the change event:
<
body
>
<
input
id
=
"numerictextbox"
/>
<
script
>
var textBox = $("#numerictextbox").kendoNumericTextBox({
change: function() {
var value = this.value();
alert(value);
}
}).data("kendoNumericTextBox");
textBox.value(12345); // this should fire change event.
</
script
>
</
body
>
4 Answers, 1 is accepted
0
Accepted
Hello,
This behavior is by design. Widget will raise change event only on user interaction. Find more information about this here.
Regards,
Georgi Krustev
Telerik
This behavior is by design. Widget will raise change event only on user interaction. Find more information about this here.
Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Bilal
Top achievements
Rank 2
answered on 01 Apr 2015, 06:08 AM
Hi,
I was looking for the same problem online and passed by this post.
The link for trigger method is broken on the page mentioned above.
http://docs.telerik.com/kendo-ui/api/framework/widget#trigger
How to trigger event on numerictextbox after setting its value by code?
Thanks
I was looking for the same problem online and passed by this post.
The link for trigger method is broken on the page mentioned above.
http://docs.telerik.com/kendo-ui/api/framework/widget#trigger
How to trigger event on numerictextbox after setting its value by code?
Thanks
0

László
Top achievements
Rank 1
answered on 01 Apr 2015, 06:40 AM
Hello Bilal,
Try this:
The documentation is here about trigger:
http://docs.telerik.com/kendo-ui/api/javascript/ui/widget#methods-trigger
Try this:
<!DOCTYPE html>
<
html
>
<
head
>
<
meta
charset
=
"utf-8"
>
<
title
>Untitled</
title
>
<
link
rel
=
"stylesheet"
href
=
"http://cdn.kendostatic.com/2015.1.318/styles/kendo.common.min.css"
>
<
link
rel
=
"stylesheet"
href
=
"http://cdn.kendostatic.com/2015.1.318/styles/kendo.rtl.min.css"
>
<
link
rel
=
"stylesheet"
href
=
"http://cdn.kendostatic.com/2015.1.318/styles/kendo.default.min.css"
>
<
link
rel
=
"stylesheet"
href
=
"http://cdn.kendostatic.com/2015.1.318/styles/kendo.dataviz.min.css"
>
<
link
rel
=
"stylesheet"
href
=
"http://cdn.kendostatic.com/2015.1.318/styles/kendo.dataviz.default.min.css"
>
<
link
rel
=
"stylesheet"
href
=
"http://cdn.kendostatic.com/2015.1.318/styles/kendo.mobile.all.min.css"
>
<
script
src
=
"http://code.jquery.com/jquery-1.9.1.min.js"
></
script
>
<
script
src
=
"http://cdn.kendostatic.com/2015.1.318/js/angular.min.js"
></
script
>
<
script
src
=
"http://cdn.kendostatic.com/2015.1.318/js/jszip.min.js"
></
script
>
<
script
src
=
"http://cdn.kendostatic.com/2015.1.318/js/kendo.all.min.js"
></
script
>
</
head
>
<
body
>
<
input
id
=
"numerictextbox"
/>
<
button
onclick
=
"changeValueFromCode()"
>Click to change value from code</
button
>
<
script
>
var textBox = $("#numerictextbox").kendoNumericTextBox({
change: function() {
var value = this.value();
alert('value changed to: ' + value);
}
}).data("kendoNumericTextBox");
function changeValueFromCode()
{
textBox.value(12345);
textBox.trigger('change');
}
</
script
>
</
body
>
</
html
>
The documentation is here about trigger:
http://docs.telerik.com/kendo-ui/api/javascript/ui/widget#methods-trigger
0

Bilal
Top achievements
Rank 2
answered on 01 Apr 2015, 09:30 AM
Thanks László a lot :)