Hi,
In my source i use the following for scrolling to a postion in the DataGrid:
var index = await LocalStorageService.GetItemAsync<double>("tripscrollindex");
await JSRuntime.InvokeAsync<object>("scroll", index);
The javascript scroll look like this and comes from your example BlazorApp1Sample1968938411:
function scroll(index) {
try {
var grid = document.getElementsByClassName("e-grid")[0].blazor__instance;
var rowHeight = grid.getRowHeight();
grid.getContent().scrollTop = (index - 1) * rowHeight;
}
catch (err)
{
var x = err
}
}
The error:
Document
| Name | Value | Type |
| ▶ | x | TypeError: Cannot read properties of undefined (reading 'getRowHeight')
at scroll (https://localhost:7092/js/sfdatagrid.js:4:30)
at https://localhost:7092/_framework/blazor.server.js:1:3501
at new Promise (<anonymous>)
at kt.beginInvokeJSFromDotNet (https://localhost:7092/_framework/blazor.server.js:1:3475)
at https://localhost:7092/_framework/blazor.server.js:1:72001
at Array.forEach (<anonymous>)
at kt._invokeClientMethod (https://localhost:7092/_framework/blazor.server.js:1:71987)
at kt._processIncomingData (https://localhost:7092/_framework/blazor.server.js:1:70029)
at connection.onreceive (https://localhost:7092/_framework/blazor.server.js:1:64432)
at o.onmessage (https://localhost:7092/_framework/blazor.server.js:1:48766) {stack: 'TypeError: Cannot read properties of undefine…ost:7092/_framework/blazor.server.js:1:48766)', message: 'Cannot read properties of undefined (reading 'getRowHeight')'} | TypeError |
In the scroll function the value of the grid = undefined.
Can you help me out please because i need the function because the DataGrid starts on the first item now.
Best regards,
Thijs van Rijswijk