I have webassembly sfgrid where i position on a row via
long lPrimaryID = 1005;
var index = await Grid.GetRowIndexByPrimaryKeyAsync(lPrimaryID);
This is working fine, but when the row is not visisble, it is positioned but not visible. How can i scroll to the row.
I have tried this one but it is not working on webassembly project.
Can you help please? IS there an easy way to fix this please?
Greetings from Syncfusion support.
From your query, we suspect that you want to scroll to the selected row based on the row index. We suggest you to use ScrollIntoViewAsync inbuilt public method to scroll to specific row or column based on row index and column index. Kindly refer the attached API link for your reference.
Please get back to us, if you have any further queries.
Thanks for the reply. This is working perfect for an observable sfgrid with one page.
But how can i position when there are more pages?
I have a table with languages LanguageID is the key
How do i know on which page the added 'language' is?
Now i am executing following code to position (perfect with one page):
lLanguageIDposition = lAddedLanguageListDTO.LanguageId;
var index = await sfLanguageGrid.GetRowIndexByPrimaryKeyAsync(lLanguageIDposition);
await sfLanguageGrid.ScrollIntoViewAsync(0, Convert.ToInt32(index), Convert.ToInt32(sfLanguageGrid.RowHeight));
I am on page one and want to position on last line in page 3.
Last line is primary key 272
when i do
var index = await sfLanguageGrid.GetRowIndexByPrimaryKeyAsync(272);
It cannot find the line?? index = -1.
So how can i determine the page where de primary key 272 is?
Can you help please?
Query: I am on page one and want to position on last line in page 3!
From your query we understand that you want to select a particular record from a Grid by navigating to its page. We have prepared sample based on your requirement using GotoPage() and SelectRow() method of Grid along with DataBound event of the Grid. Refer the below code snippet and sample for your reference.
<SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true">
<GridEvents DataBound="DataHandler" TValue="Order"></GridEvents>
public async Task DataHandler()
if (InitialRender) // to handled during the initial rendering of Grid
InitialRender = false;
for (int i = 1; i <= Grid.PageSettings.PageCount; i++)
List<Order> Rows = await Grid.GetCurrentViewRecordsAsync(); // returns the current view data
for (int j = 0; j < Grid.PageSettings.PageSize; j++)
if (Rows[j].OrderID == Value)
ContinuePaging = false; // prevent the default navigation
await Grid.GoToPageAsync(i + 1); // if current page does not contain the record navigate to next page.
Please get back to us if you have any further queries.
the databound DataHandler is ok for positioning but the line 1148 is selected but not shown on the screen.
Can you tell me how to make the selected line visible on te screen wth programming code
and not using EnableVirtualization="true". I do not like the paging with EnableVisualisation.
I have uploaded my new version.
Can you help please
Scroll.js solved my problem
Thanks for an update.
We’re happy to hear that you have found the solution to the proposed issue. Please get back to us if you need any further assistance.