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

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

    Posted 31 May 2012 Link to this post

    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
  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.
  3. Kendo UI is VS 2017 Ready
Back to Top