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

mvvm binding with templates and kendoListView

1 Answer 570 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 27 Sep 2017, 12:36 PM

I am trying to use mvvm binding within a template that is applied to a kendo list view.  Template variables are working but the data-bind attributes are not.  Is this supported?  

<div id="list"></div>
 
<script id="template" type="text/x-kendo-template">
    <div>
    <button data-bind="visible:  alreadyAttending, click: onClick">
        Your id is ${ID}
    </button>
  </div>
</script>
 
var data = [];
data[0] = { alreadyAttending:  true, ID:  1, onClick:  function() { alert("Click 1"); }};
data[1] = { alreadyAttending:  false, ID:  2, onClick:  function() { alert("Click 2"); }};
 
 $("#list").kendoListView({
   dataSource: data,
   template: kendo.template($("#template").html())
 });

 

Fiddle

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 29 Sep 2017, 10:46 AM
Hello Chris,

The MVVM bindings would work only if the ListView itself is created inside an MVVM environment. Here is the updated Fiddle where the bindings work:
https://jsfiddle.net/q99ufo3c/6/

Regards,
Tsvetina
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
MVVM
Asked by
Chris
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or