Hi again!
For me it is an issue, if switch widget should "replace" checkbox on my iPad, it should also fire "changed" event.
Fiddle:
http://jsfiddle.net/GewUa/14/
For me it is an issue, if switch widget should "replace" checkbox on my iPad, it should also fire "changed" event.
Fiddle:
http://jsfiddle.net/GewUa/14/
4 Answers, 1 is accepted
0
Hi Alex,
Petyo
the Telerik team
Programmatically checking an HTML checkbox does not trigger its change event - check this fiddle:
http://jsfiddle.net/7WVqL/135/
Petyo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Alex
Top achievements
Rank 1
answered on 13 Sep 2012, 09:40 AM
Of course it's true, but as I said, I see switch widget as a replacement of chekcbox and thus, if my application should do something on change I expect triggering change event.
Trying to fire this event by myself I found (maybe) another issue in your implementation. I tried to bind on "kendoMobileSwitch" change event, as described in documentation, but there is no "kendoMobileSwitch" data in input. Here is fiddle:
http://jsfiddle.net/GewUa/24/
I read the data with "kendoMobileSwitch" key and it is undefined! Do I something wrong?
In my application I have 4 switches, and only first one has this data, I could not explain this.
Please help.
Trying to fire this event by myself I found (maybe) another issue in your implementation. I tried to bind on "kendoMobileSwitch" change event, as described in documentation, but there is no "kendoMobileSwitch" data in input. Here is fiddle:
http://jsfiddle.net/GewUa/24/
I read the data with "kendoMobileSwitch" key and it is undefined! Do I something wrong?
In my application I have 4 switches, and only first one has this data, I could not explain this.
Please help.
0
Accepted
Hi Alex,
Petyo
the Telerik team
You can do that workaround in the view init event handler. The application (and its widgets) are not initialized immediately.
Regards,Petyo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Alex
Top achievements
Rank 1
answered on 13 Sep 2012, 10:56 AM
Thanks, thats worked for me. The reason, that first switch data was present, and another not, just simple : first switch was on the first view, and another on another views, and as I understood, view initialized just before showing.
Here is a sample to make switch fire change event to input:
Here is a sample to make switch fire change event to input:
var kendoMobileViewInit = function(e){
$(e.view.element).find('.my-switch-class').each(function(){
var switchData = $(this).data("kendoMobileSwitch");
if(switchData)
switchData.bind("change", function(e) {
$(this.element).trigger('change');
});
});
};