I'm trying to add filtering to the RadzenDropDownDataGrid but I can't seem to get it to work. In fact nothing happens when I type anything in the search field. I've been through the documentation and it seems pretty straight forward but I must be missing something.
Any idea on what I'm doing wrong?
@using RLI.ContracPac.Experience.Client.Models.ClassCode;
@using RLI.ContracPac.Experience.Client.Models.Quote;
@inject DialogService dialogService
<div class="class-code-input">
<RadzenPanel Class="rz-m-0" Style="border: thin; color: black; border-style: solid;">
<HeaderTemplate>
<RadzenStack Gap="0">
<RadzenText TextStyle="TextStyle.H6"><b>Type of work</b></RadzenText>
<br />
<RadzenText TextStyle="TextStyle.Subtitle1">Describe the owner's primary operation</RadzenText>
</RadzenStack>
</HeaderTemplate>
<ChildContent>
<RadzenStack Gap="5">
@foreach (var classCodeControl in ClassCodes!)
{
var indexOf = ClassCodes.IndexOf(classCodeControl);
var uniqueControlName = $"ClassCodeDropDown{indexOf}";
<RadzenStack Orientation="Orientation.Vertical">
<RadzenStack Orientation="Orientation.Horizontal">
<RadzenDropDownDataGrid Name=@uniqueControlName Data=@ClassCodeModels AllowColumnResize="true" @bind-Value=classCodeControl.ClassCode FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
ValueProperty="ClassCodeNumber" TextProperty="Description" Style="min-width:600px" AllowFiltering="true"
FilterOperator="StringFilterOperator.Contains" AllowFilteringByAllStringColumns="true">
<Columns>
<RadzenDropDownDataGridColumn Property="ClassCodeNumber" Title="ISO" Width="100px" />
<RadzenDropDownDataGridColumn Property="Description" Title="Description" Width="350px" />
<RadzenDropDownDataGridColumn>
<Template Context="data">
<RadzenButton Variant="Variant.Filled" Click=@(args => OpenClassCodeDialog(@data.ClassCodeNumber)) Style="border: none; color: black;" Text="Details" />
</Template>
</RadzenDropDownDataGridColumn>
</Columns>
</RadzenDropDownDataGrid>
<RadzenButton Click=@(args => ClassCodeDeleted(@indexOf)) Visible=@(classCodeControl.IsPrimaryOperation != true) ButtonStyle="ButtonStyle.Danger" Icon="delete"></RadzenButton>
</RadzenStack>
<RadzenRequiredValidator Component=@uniqueControlName Text="You must enter a class code" Style="font-weight: bold; padding: 5px" />
</RadzenStack>
}
<RadzenButton Variant="Variant.Text" Visible="ClassCodes!.Count != 3" Click=@(args => AddNewClassCodeControl()) Style="border: none; color: black;" Text="Add another type of work" />
</RadzenStack>
</ChildContent>
</RadzenPanel>
</div>
@code {
[Parameter]
public List<ClassModel>? ClassCodes { get; set; }
[Parameter]
public EventCallback<List<ClassModel>?> ClassCodesChanged { get; set; }
[Parameter]
public DateTimeOffset? EffectiveDate { get; set; }
[Parameter]
public bool ShowDeleteButton { get; set; }
private List<ClassCodeModel>? ClassCodeModels { get; set; }
protected override void OnInitialized()
{
base.OnInitialized();
if (ClassCodes!.Count() == 0)
ClassCodes!.Add(new ClassModel() { IsPrimaryOperation = true });
//Get all class codes to populate drop down
ClassCodeModels = GetClassCodes();
}
protected async Task OpenClassCodeDialog(string classCodeNumber)
{
await dialogService.OpenAsync<ClassCodeDialogCard>("",
new Dictionary<string, object>() { { "ClassCode", classCodeNumber! }, { "EffectiveDate", EffectiveDate! } },
new DialogOptions() { Width = "40%", Height = "95%", Resizable = true }).ConfigureAwait(false);
}
private void AddNewClassCodeControl()
{
ClassCodes!.Add(new ClassModel());
}
private void ClassCodeDeleted(int index)
{
ClassCodes!.RemoveAt(index);
}
private List<ClassCodeModel> GetClassCodes()
{
//TODO: Replace with call to QuestionSet API to get all class code questions
var classCodes = new List<ClassCodeModel>();
classCodes.Add(new ClassCodeModel() { ClassCodeNumber = "91340", Description = "General Contractor - Commercial Carpentry/NOC" });
classCodes.Add(new ClassCodeModel() { ClassCodeNumber = "91341", Description = "Interior Finish Carpentry" });
classCodes.Add(new ClassCodeModel() { ClassCodeNumber = "92215", Description = "Driveway, Parking Area, or Sidewalk Paving or repaving" });
classCodes.Add(new ClassCodeModel() { ClassCodeNumber = "94569", Description = "Floor Covering Installation" });
classCodes.Add(new ClassCodeModel() { ClassCodeNumber = "99746", Description = "Tile, Stone, Marble, Mosiac or Terrazzo Work" });
return classCodes;
}
}