Hi , I'm using LoadData
to load data for Grid from api and in my case filtering and sorting works on server.
Thanks for your question it helped me.
<RadzenGrid AllowFiltering="true" AllowPaging="true" Count="result.TotalCount" PageSize="getUserTableDataInput.MaxResultCount" LoadData="LoadData" AllowSorting="true" Data="@result.Items" ColumnWidth="200px">
<Columns>
@foreach (var key in columns.Keys)
{
<RadzenGridColumn TItem="ExpandoObject" Property="@key" Title="@columns[key].ToString()">
<Template Context="data">
<span>@((data as IDictionary<string, object>)[key].ToString())</span>
</Template>
<FilterTemplate Context="data">
<i class="material-icons">search</i>
<input @onchange="@((arg)=>SetFilterValue(data.Property,arg))" />
</FilterTemplate>
</RadzenGridColumn>
}
</Columns>
</RadzenGrid>
async Task LoadData(LoadDataArgs loadData)
{
getUserTableDataInput.SkipCount = loadData.Skip ?? 0;
getUserTableDataInput.OrderBy = loadData.OrderBy;
getUserTableDataInput.Filter = loadData.Filter;
await GetUserTableData();
}
async Task SetFilterValue(string p, ChangeEventArgs changeEventArgs)
{
if (getUserTableDataInput.DictionaryFilter == null)
{
getUserTableDataInput.DictionaryFilter = new ConcurrentDictionary<string, object>();
}
getUserTableDataInput.DictionaryFilter.AddOrUpdate(p, changeEventArgs.Value, (key, oldValue) => changeEventArgs.Value);
await GetUserTableData();
}