Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions knowledge-base/grid-scroll-to-selected-row.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Scroll to Selected Grid Row
description: How to scroll a grid to the selected table row
type: how-to
page_title: Scroll to Selected Grid item
slug: grid-kb-scroll-to-selected-row
position:
tags:
ticketid: 1513767
res_type: kb
---

## Environment
<table>
<tbody>
<tr>
<td>Product</td>
<td>Grid for Blazor</td>
</tr>
</tbody>
</table>


## Description
I would like to pre-select a row when the page is loaded, and I would like to show the grid with that row scrolled to the top, or sorted to appear on top.

## Solution
You can find a selected row in the grid markup by the `k-state-selected` CSS class it has, and use a bit of JavaScript to scroll to it - browsers provide the `scrollIntoView()` method for that.

With **row virtualization**, however, the selected row may not be rendered. That is why you need to find its position and scroll to it through the `Skip` parameter of the Grid.

You can find examples in the following sample project: https://github.com/telerik/blazor-ui/tree/master/grid/scroll-to-selected-row