Kendo Mobile Switch not updating viewModel

4 posts, 0 answers
  1. Richard
    Richard avatar
    7 posts
    Member since:
    Mar 2012

    Posted 16 Jun 2012 Link to this post

    When I use a checkbox it will update my view model no problem, but when I turn on data-role="switch" it no longer updates. Is there something I need to do differently.
  2. d2uX
    d2uX avatar
    16 posts
    Member since:
    Jul 2012

    Posted 19 Jul 2012 Link to this post

    How did you bind your data to the switch?
  3. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2895 posts

    Posted 24 Jul 2012 Link to this post

    Hi Richard,

    When you add a data-role="switch" attribute to the input kendo mobile application will initialize a widget. In order to monitor its state you can hook up to to the change event of the component via data-change attribute.
    <input id="foo" data-role="switch" data-change="isChecked" />
     
    function isChecked(e) {
        //change event
    }

    I hope this helps.

    Kind regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  4. Running
    Running avatar
    3 posts
    Member since:
    Jun 2018

    Posted 27 Jun 2018 in reply to Alexander Valchev Link to this post

    This is false. Refer to this post for the accurate way of initializing a Switch widget https://www.telerik.com/forums/use-the-mobile-switch-within-regular-mvvm-framework
Back to Top