JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › find a specific row in a grid › Reply To: find a specific row in a grid
May 11, 2022 at 8:12 pm
#103216
Participant
I have
<Grid @ref="grid" OnCellClick="CellClicked" OnReady="(x) => GridReady(x)" DataSource="@projects">
<Columns>
<Column DataField="Id" Label="" Visible="false" AllowEdit="false" AllowSelect="false" />
<Column DataField="Name" Label="Name" AllowEdit="false" AllowSelect="false" />
</Columns>
</Grid>
and
private async void GridReady(Grid grid)
{
var selectedProjectId = await LocalStorage.GetItemAsync("SelectedProject");
if (!selectedProjectId.Equals(Guid.Empty) && projects.Any(x => x.Id.Equals(selectedProjectId)))
{
grid.SelectRows(projects.Where(x => x.Id.Equals(selectedProjectId)));
}
else
{
ClearSelection();
}
}
- I don’t have the index of the row I want to select, I have the object that is displayed in the row
- Setting a breakpoint into the GridReady Method I can see the page and grid load in the browser and can clearly see the entries in the grid. BUT grid.Rows is STILL EMPTY in this method.
Additional information: I am on Blazor .NET6 WebAssebmly and use the latest smart.Blazor version that nuget suggested.