Hi team,
I have two grids on my page and based on the row selection of the first grid, i need to select and scroll to the row in the second grid.
I followed couple of links below as well as the samples provided which describe on how to do it, but I am getting an exception .Note: The samples work though.
https://www.syncfusion.com/forums/162511/scroll-to-selected-row
The exception is
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Failed to execute 'scroll' on 'Window': The provided value is not of type 'ScrollToOptions'.
TypeError: Failed to execute 'scroll' on 'Window': The provided value is not of type 'ScrollToOptions'.
Below is the code behind.
public async void KittingPartsGridRowSelected(RowSelectEventArgs<KittingSchedule> args)
{
SelectedRowIndex = await kittingScheduleGrid.GetRowIndexByPrimaryKey(args.Data.KittingScheduleID);
selectedPartsScheduleID = args.Data.KittingScheduleID;
await kittingScheduleGrid.SelectRow(SelectedRowIndex);
await JSRuntime.InvokeAsync<object>("scroll", SelectedRowIndex);
}
}
public async Task KittingScheduleDataBoundHandler(object args)
{
await kittingScheduleGrid.SelectRow(SelectedRowIndex);
await JSRuntime.InvokeAsync<object>("scroll", SelectedRowIndex);
}
Below is the javascript function
function scroll(index){
var grid = document.getElementById("kittingScheduleGrid")[0].blazor__instance;
var rowHeight = grid.getRowHeight();
grid.getContent().scrollTo = (index - 1) * rowHeight;
}
Thanks
Ba
|
function scroll(index) {
var grid = document.getElementById("kittingScheduleGrid").blazor__instance;
var rowHeight = grid.getRowHeight();
grid.getContent().scrollTop = (index - 1) * rowHeight; //do the calculations to set the scrollTop value for grid content
}
|
Hello Renjith,
Thank you for looking at the issue, your effort is much appreciated.
With the new changes, I don't see the error anymore and the scroll also works as expected.
Thanks
Baba