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

How to set data on a specific page

2 Answers 314 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cassidy
Top achievements
Rank 1
Cassidy asked on 28 Sep 2017, 06:06 PM

I have a grid with many records (over 1M records) in my DB. I want to only request the data that will be displayed on the current grid from my DB. What I do is pass my current page and pageSize to my java code in order to determine how many records I will skip in my DB.

Ex. If I navigate to page 5 with a pageSize of 20, I will skip the first 80 records and receive the next 20.

This is working so far, but my issue is that when I receive those 20 records of data and place it in my dataSource; page 5 will show up empty since the data will only be displayed on page 1.

A work-around I found is to fill my dataSource data with empty JSON objects {}. This works, but if I were to input 100,000 empty JSON objects, the program will crash.

What can I do to display my data on the specific page I'm on, and basically ignore all the other pages when I'm not visiting them?

2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 02 Oct 2017, 12:20 PM
Hi Cassidy,

Can you confirm that you enabled serverPaging in the DataSource? When the property is set to true, the DataSource sends the parameters for paging with the read request and populates only the current page of Grid with data. 
If you enabled the property but the paging doesn't work, please show us your Grid and DataSource definitions.

Regards,
Tsvetina
Progress Telerik
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
Cassidy
Top achievements
Rank 1
answered on 02 Oct 2017, 04:16 PM

Hi Tsvetina,

My problem is solved now that I did serverPaging = true.

Thank you for the help!

Tags
Grid
Asked by
Cassidy
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Cassidy
Top achievements
Rank 1
Share this question
or