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

Scroll to selected row/cell

1 Answer 393 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Seyfor
Top achievements
Rank 1
Seyfor asked on 24 Jun 2016, 04:23 PM

I would like to scroll to selected cell/row and I would like the same design as if the user would navigate throug key down/up. That means when navigating down, selected row would be the last in grid scroll, and when navigating up, selected row would be first.

How can I achieve that? I am pretty sure that I must call some method (already written for keyboard navigation), just don't know which.

http://dojo.telerik.com/oLuPO

I tried with this, but it does not give me the exact result I want (for scrolling down):

var itemScrollTop = grid.select()[0].offsetTop;
grid.wrapper.find('.k-grid-content.k-auto-scrollable').animate({ scrollTop: itemScrollTop });

1 Answer, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 28 Jun 2016, 12:57 PM
Hi Matjaž,

The desired functionality is not provided and supported out-of-the-box. Custom logic implementation will be needed to achieve it.

The Kendo UI related classes that can prove useful are '.k-grid-content' - the scrollable div, '#grid_active_cell' - the currently active cell when navigating, and '.k-state-selected' - the selected cell(s).

Also, the change event is fired each time a different row or cell is selected. You can use it to get the offset of the currently selected element, and the scrollTop() of the scrollable div, and store them for consequent calculations when programmatically triggered scrolling is required.

Let us know if you have other questions about Kendo UI

Regards,
Dimiter Topalov
Telerik
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Tags
Grid
Asked by
Seyfor
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Share this question
or