ListView + Pager in MVVM databind

3 posts, 1 answers
  1. Dovydas
    Dovydas avatar
    5 posts
    Member since:
    Nov 2011

    Posted 09 Feb Link to this post

    Hi,

    when I use declarative syntax, e.g.

    <div id="app">
          <div id="list" data-role="list" data-bind="source: productsSource" data-template="tmpl"></div>
          <div id="pager" data-role="pager" data-bind="source: productsSource"></div>
     </div>

     and use MVVM binding to bind to dataSource:

    var vm= kendo.observable({
               productsSource: new kendo.data.DataSource({
                        pageSize: 4, page: 1,
                        serverFiltering: true,
                        serverSorting: true,
                        transport: {
                              read: {
                                  url: "http://demos.telerik.com/kendo-ui/service/Products",
                                  dataType: "jsonp"
                                 
                                  }
                        }
                    })
                          
                });
             
             
              kendo.bind($("#app"), vm);  

     

     there are two requests to http://demos.telerik.com/kendo-ui/service/Products (one for list and one for pager).

    The whole example could be seen on: http://dojo.telerik.com/OHeMI/2

    It is possible to reduce request count only to one?

     

  2. Answer
    Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 11 Feb Link to this post

    Hi Dovydas,

    In order to resolve the issue you should set a data-auto-bind="false" to the pager element. Here is a link to the updated example:


    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Dovydas
    Dovydas avatar
    5 posts
    Member since:
    Nov 2011

    Posted 11 Feb in reply to Alexander Valchev Link to this post

    thanks a lot.
Back to Top