Programmatically set scroll offset for a KendoReact Grid with virtual scrolling

1 Answer 347 Views
Grid
Thomas Mittag
Top achievements
Rank 1
Thomas Mittag asked on 26 Jun 2022, 09:53 PM

I have implemented the virtual scrolling on a KendoReact grid based on the example given in the documentation with a remote data source.

This appears to work well. However, I have a scenario where I want to scroll the grid to a specific location. I am able to display the correct page by setting the Skip value on the state of the Grid, however.  The scrollbar position is not correctly recalculated when I set the skip value. Instead, the scrollbar remains at position 0.

How can I correctly set the scrollbar location?

Thanks

Thomas

Kishan
Top achievements
Rank 1
commented on 29 Aug 2022, 01:47 PM

Hello sir,

I face the same issue. Please try to help me fix this issue.

Thanks,

Kishan Bhagat 

Konstantin Dikov
Telerik team
commented on 31 Aug 2022, 10:25 AM

Hi Krishan,

Here is an example demonstrating how to use scrollIntoView after the component is rendered:

With hooks you can use "React.useEffect" and is some cases you also might need to add setTimeout, if the data is loaded remotely:

this.setState({ processedData: this.data, total: response.data.rows_total, skip: nextSkip });
setTimeout(()=>{
     this.grid.scrollIntoView({ rowIndex: firstSelectedItem });
})

We also have a logged issue for using scrollIntoView for the last items:

Nevertheless, if further assistance is needed and your scenario differs, please feel free to get back to us.

 

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 28 Jun 2022, 08:34 AM

Hi Thomas,

I have answered in the ticket that you have opened with the same question. If further questions arise, I would suggest that we continue the conversation in the ticket.

 

Best Regards,
Konstantin Dikov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Thomas Mittag
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or