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

Can I bind to a datasource object inside of an observable object?

1 Answer 43 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steven
Top achievements
Rank 1
Steven asked on 06 Dec 2013, 07:51 PM
Seems like this should work, but I cannot get it to :(

<!--List-->
<div id="list"
     data-role="view"
     data-title="List">
     
    <div class="view-content">
        <h2>List</h2>
         
        <ul data-role="listview" data-model="obs" data-bind="source: groupedData" data-template="my-template" data-header-template="header-template"></ul>
         
    </div>
</div>
 
<script type="text/x-kendo-template" id="my-template">
  <h3 class="item-title">#: name #</h3>
  <p class="item-info">#: description #</p>
</script>
 
<script type="text/x-kendo-template" id="header-template">
    #: value #
</script>
 
<script type="text/javascript">
    var obs = new kendo.data.ObservableObject({
     
        groupedData: new kendo.data.DataSource({
          data: [
              { name: "Hello World 1", description: "Just a test...", letterGroup: "H1" },
              { name: "Hello World 1", description: "Just a test...", letterGroup: "H1" },
              { name: "Hello World 1", description: "Just a test...", letterGroup: "H1" },
              { name: "Hello World 2", description: "Just a test...", letterGroup: "H2" },
              { name: "Hello World 2", description: "Just a test...", letterGroup: "H2" }
          ],
          group: { field: "letterGroup" }
        })
    });
</script>

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 09 Dec 2013, 08:41 AM
Hello Steven,

Please take a look at the following documentation article about MVVM usage in Kendo UI Mobile. The data model attribute should be set to the view itself. 

Regards,
Petyo
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
Tags
General Discussion
Asked by
Steven
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or