This is a migrated thread and some comments may be shown as answers.

Reset Switch back to original value

1 Answer 287 Views
Switch
This is a migrated thread and some comments may be shown as answers.
Ezequiel
Top achievements
Rank 2
Ezequiel asked on 06 Sep 2019, 02:02 PM

Before version 2019.2 I used MobileSwitch for checkboxes and when I want to clear a form I did this:

1._form.reset();
2.$(_form).find("[type=checkbox]").each(function () {
3.      $("#" + this.id).data("kendoMobileSwitch").refresh();
4.})

 

Now, using Switch, I've changed line 3 to

$("#" + this.id).data("kendoSwitch").refresh();

but that didn't work.

 

How can I achieve the same with new Switch?

1 Answer, 1 is accepted

Sort by
0
Ezequiel
Top achievements
Rank 2
answered on 09 Sep 2019, 07:59 PM

I solved with a workaround

1._form.reset();
2.$(_form).find("[type=checkbox]").each(function () {
3.     var _switch = $("#" + this.id).data("kendoSwitch");
4.     $("#" + this.id).data("kendoSwitch").value(_switch.element[0].defaultValue)
5.})

 

Tags
Switch
Asked by
Ezequiel
Top achievements
Rank 2
Answers by
Ezequiel
Top achievements
Rank 2
Share this question
or