I'm having some trouble with the behaviour of a checkbox "change" event in a Kendo Mobile app and i've run out of ideas. I apologise if this is not the right place to ask these things. Any help will be appreciated.
Basically, i have a checkbox and a "change" event handler. In the handler, i do something depending on the value of "this.checked", which should indicate if the checkbox is checked or not after it's changed its state. Nothing crazy. Here's a fiddle
with a simple example of this using plain jQuery (i've tested it mostly in Chrome and an Android device).
Now, as soon as i kendoize
that example, the checkbox no longer works properly. Here's another fiddle
It seems like the checkbox now works backwards (the message says "the checkbox is NOT checked" when you check it and vice versa), but what's actually happening is that the "checked" value is not being updated before the "change" event handler is called. It's being updated afterwards. So, adding an ugly setTimeout on the handler so the code executed on the next JS event cycle, the example now magically works as expected
. But that's a really ugly hack.
The problem is that if i want to use the Kendo MVVM style for that example, the weird behaviour of the change event also manifests there --as seen in this fiddle
--, and i'd have no idea on how to make the setTimeout hack there.
Has anyone else come across this problem? Am i doing something wrong? Or is it a Kendo bug?