some MVVM click bindings don't work

2 posts, 0 answers
  1. fbaptiste
    fbaptiste avatar
    19 posts
    Member since:
    Apr 2007

    Posted 24 Jul 2014 Link to this post

    Using Kendo UI version 2014.1.528

    I have the following scenario (simplified):

    <script type="text/x-kendo-template" id="tmpl">
    <div class="list-group-item-heading" data-bind="click: OnClick1">
        ${DisplayName1}
    </div>

    <div class="list-group-item-heading" data-bind="click: OnClick2">
        ${DisplayName2}
    </div>
    </script>

    <div class="list-group" data-bind="source: GetData" data-template="tmpl">
    </div>

    in which case the first click works as expected and calls OnClick1. however, the second click and any following click-bindings do not work at all.

    any idea of what might be the issues
  2. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 25 Jul 2014 Link to this post

    Hello Fred,

    the problem is due to multiple root elements being present in the template. If you wrap them in a single element (another div), the binding should work fine. 

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
Back to Top