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

2 posts, 0 answers
  1. Steven
    Steven avatar
    7 posts
    Member since:
    Nov 2013

    Posted 06 Dec 2013 Link to this post

    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>
  2. Petyo
    Admin
    Petyo avatar
    2438 posts

    Posted 09 Dec 2013 Link to this post

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