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

2 posts, 0 answers
  1. Saurav
    Saurav avatar
    4 posts
    Member since:
    Apr 2012

    Posted 31 May 2012 Link to this post

    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}"  />

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

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

    Thanking you,
  2. Ron
    Ron avatar
    2 posts
    Member since:
    Aug 2012

    Posted 31 Aug 2012 Link to this post

    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.
Back to Top