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

how to change switch onLabel and offLabel in template [urgent]

1 Answer 356 Views
Switch (Mobile)
This is a migrated thread and some comments may be shown as answers.
Saurav
Top achievements
Rank 1
Saurav asked on 31 May 2012, 01:16 PM
HI,
I have used switch in listview. i want to change label of switch. i am able to made switches in listview using template. How can i change the label for the switches. My code:

<script id="StudentAttendenceTemplate" type="text/x-kendo-template">
        ${studentName} <input id="switchAttendence" data-role="switch" data-change="CraeteAttendence" type="checkbox" data-align="right" value="${studentID}"  />
 </script>

$("#listOfStudents").kendoMobileListView({
   dsData:[{studentID: "101", studentName: "Saurav" },{studentID: "102", studentName: "Sujan" }] 
                    dataSource: kendo.data.DataSource.create({ data: dsData }),
                    style: "inset",
                    template: $("#StudentAttendenceTemplate").html()
                });

Can any one suggest me the solution as soon as possible.

Thanking you,
Shree

1 Answer, 1 is accepted

Sort by
0
Ron
Top achievements
Rank 1
answered on 31 Aug 2012, 09:47 PM
Here's a working snippet:

<input data-role="switch" data-on-label="YES" data-off-label="NO" />

I checked out your code, and I can't seem to get the data-change event to be called any time other than when I move to the view that the switch is in. If I set the change event handler in the javascript, it gets called appropriately every time, but when I set the data-change attribute in the html, as mentioned, it only gets called when I move to the view that the switch is in.
Tags
Switch (Mobile)
Asked by
Saurav
Top achievements
Rank 1
Answers by
Ron
Top achievements
Rank 1
Share this question
or