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

some MVVM click bindings don't work

1 Answer 60 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
fbaptiste
Top achievements
Rank 1
fbaptiste asked on 24 Jul 2014, 09:06 PM
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

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 25 Jul 2014, 10:53 AM
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!
 
Tags
MVVM
Asked by
fbaptiste
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or