Hey. I am new to Fluent UI and having some difficulty with datagrid.
I have a FluentDataGrid to show list of model. I want to filter the items according to a property. When i query and update the items and use updateDataAsync() method, datagrid does not update and at the end of the method browser gives error.
How am i suppose to update DataGrid when items list changes?
This is my datagrid:
<FluentDataGrid @ref="@MealGrid" TGridItem="Meal" Items="@FilteredMeals" ShowHover="true" ResizableColumns=true Pagination="@pagination" GridTemplateColumns="0.2fr 0.1fr 0.1fr 0.6fr 0.2fr 0.2fr" RowClass="@rowClass" RowStyle="@rowStyle" Style="height: auto;overflow:auto;">
this is the method triggered for filtering:
private async Task FilterMeals()
{
IQueryable<Meal> tempMeals;
if (!string.IsNullOrEmpty(searchValue))
tempMeals = FilteredMeals.Where(x => x.Foods != null && x.Foods.Any(food => food.Name.ToLower().Contains(searchValue.ToLower())));
else
tempMeals = meals;
if (tempMeals != meals && tempMeals!=null)
FilteredMeals = tempMeals;
searchValue = null;
mealFilter = "All";
await MealGrid.RefreshDataAsync();
}
The page is working in interactiveserver mode.All other components works well.
i have debugged the method and the query is working well. FileteredMeals (which datagrid uses as items) updates according to filtering. But the grid does not update.
Thanks.