mvvm binding with templates and kendoListView

2 posts, 0 answers
  1. Chris
    Chris avatar
    4 posts
    Member since:
    Jul 2013

    Posted 27 Sep Link to this post

    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

  2. Tsvetina
    Admin
    Tsvetina avatar
    2087 posts

    Posted 29 Sep Link to this post

    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.
Back to Top