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

Display Grid Data Based on Offset

1 Answer 259 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nate
Top achievements
Rank 1
Nate asked on 21 Jan 2015, 12:49 AM
My scenario:
* Assume a Kendo Grid with virtual scrolling
* Backend data source contains 10,000 records
* Programmatically (triggered by another user action), want to show records 5,000-5,050 in the grid
* Want the virtual scrollbar in Kendo Grid to show that we are "halfway" in the data
* Want the user to be able to scroll up to see records < 5,000 (thereby triggering an ajax data call to load records 4,950 - 4,999, etc.)
* Want the user to be able to scroll down to see records > 5,050 (thereby trigger an ajax data call to load records (5,051 - 5,100, etc.)
* IDEALLY, do not want to load any more data into the Grid then necessary (for DOM and browser performance reasons).

Perhaps, I'm missing a function or option on the Grid, but we'd like to initially show the grid such that it displays data at a specific offset in our data set.

Is this possible?  I noticed that when using virtual scrolling, the JSON object  returned by the server is:

{
results: [... data records here...],
total: 10,000
}

The total property tells Kendo that the scrollbar should "indicate" there's 10,000 records in the datasource.  

We'd like to show the data starting at row 5,000.  Thus, I think the JSON object returned from the server would be:

{
results: [... data records here...],
total: 10,000
offset: 5,000
}

This would tell the Kendo ui grid that it should "show" the scrollbar 50% vertically scrolled and then display the results data.

Does this capability exist now in the Grid?  If not, has anybody achieved this?

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 22 Jan 2015, 03:30 PM

Hello Nate,

I am afraid that there is no method that you can use in order to force/scroll the grid to show certain records, when virtualization is enabled. The problem comes from the difficulty of calculating the scroller position correctly. I am afraid that at this point I am not able to offer you any suitable workaround.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Nate
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or