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

setiing pageSize dynamically causing read

7 Answers 124 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Marcin
Top achievements
Rank 1
Veteran
Marcin asked on 20 Mar 2013, 05:50 PM
I would like to change page size of DataSource depends on my needs. However when I'm setting:
DataSource.pageSize(10);
it is causing that data is read from server.

I would like to prevent such behaviour and read data from server only on read method, how to achieve that?

Similar issue is with page method. From time to time it causes read with initial settings so it reads data twice. with diferent params. when I comment out DataSource.page(1); everthing is working.

I also realize that this is happening if there is no data when I calling this methods. If there is data there is no read action.

7 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 22 Mar 2013, 03:01 PM
Hello Marcin,

Indeed this is the expected behavior - when you call the page method new request for the particular page will be performed. If you are changing the pageSize and use serverPaging again request will be performed.

I suggest you to consider using the query method - which allows you to execute the commands you want at once - instead of suing read / page/ pageSize which all use it under the hood.

e.g.

$('#gridName').data().kendoGrid.dataSource.query({pageSize:15,page:3})


Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Marcin
Top achievements
Rank 1
Veteran
answered on 22 Mar 2013, 03:10 PM
Hi, I just wonder, I'm not using server paging, only local. And I only go to switch page on grid before request to always display 1st page after request/manual filter change. Is it any way to do that without round trip to server? Maybe I can do that during request?
0
Petur Subev
Telerik team
answered on 26 Mar 2013, 10:51 AM
Hello again Marcin,

I am sorry but I did not understand what you mean, could you please clarify?

Information about serverPaging is covered in our documentation.

Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Aleksandr
Top achievements
Rank 1
answered on 30 Mar 2017, 11:31 AM

Hey, I've got the same problem. Changing pagesize triggers read...I'd like to prevent this behavior. Because everything was already read and loaded it is just pagesize being adjusted to window.

0
Konstantin Dikov
Telerik team
answered on 03 Apr 2017, 07:27 AM
Hello Aleksandr,

Using the pageSize method of the DataSource will trigger the Read action only if server operations are enabled. With that in mind, please ensure that you are not enabling any server operations in the DataSource or if you are using the MVC wrappers, set the ServerOperation property of the DataSource to "false":
.DataSource(dataSource => dataSource
    .Ajax()
    .Batch(true)
    .ServerOperation(false)


Best Regards,
Konstantin Dikov
Telerik by Progress
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.
0
Aleksandr
Top achievements
Rank 1
answered on 06 Apr 2017, 10:44 AM

Hi, thanks for advise. Doesn't solve my problem, though.

I'm using AngularJS version, and I don't see ServerOperation or anything like this in dataSource properties of initialized grid

0
Alex Hajigeorgieva
Telerik team
answered on 10 Apr 2017, 08:55 AM
Hello Aleksandr,

To ensure that we fully understand the scenario, could you please provide the configuration of the Kendo UI Grid and Data Source?

Alternatively, you may modify this demo I prepared for your convenience:

http://dojo.telerik.com/AkOPo

If you open the Network tab in the developer tools, you can see that only one read request is made. Changing the page or page size does not produce another request and this is the expected behaviour because the server operations are not enabled so the Kendo UI Grid will request all the data at once.

Let us know how your scenario differs so we can advise accordingly. Look forward to your response.

Kind Regards,
Alex Hajigeorgieva
Telerik by Progress
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 visualisation (charts) and form elements.
Tags
Data Source
Asked by
Marcin
Top achievements
Rank 1
Veteran
Answers by
Petur Subev
Telerik team
Marcin
Top achievements
Rank 1
Veteran
Aleksandr
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Alex Hajigeorgieva
Telerik team
Share this question
or