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

ListView + Pager in MVVM databind

2 Answers 314 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Ernestas
Top achievements
Rank 1
Ernestas asked on 09 Feb 2016, 09:38 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 11 Feb 2016, 11:49 AM
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!
 
0
Ernestas
Top achievements
Rank 1
answered on 11 Feb 2016, 11:52 AM
thanks a lot.
Tags
ListView
Asked by
Ernestas
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Ernestas
Top achievements
Rank 1
Share this question
or