Blazorise: Bug: ClearFilterCommand does not clear FilterTemplates

Created on 16 Jul 2020  路  4Comments  路  Source: stsrki/Blazorise

Describe the bug
If FilterTemplate is defined and ClearFilterCommand is fired, filters will be removed, but old inputs bill stay in filter inputs.

To Reproduce
Steps to reproduce the behavior:

  1. Go to DataGridPage
  2. Filter with "First Name" and "City" (this columns has FilterTemplates)
  3. Click on 'Clear Filter'
  4. See that filtering is gone, but your input stays

Expected behavior
Filter Templates will be reinitialize, so that old inputs removed by clear filter.

Screenshots
grafik
grafik
grafik

Bug 馃悶

Most helpful comment

@DDDenisSobek I reproduced it on my side and it seems it's a bug. I will put on backlog for next milestone.

All 4 comments

How do you bind values of input field and the filter context?

More or less like 'First Name' in DataGridPage.

...
<FilterTemplate>
    <NumericEdit TValue="int?" Step="1" Decimals="0" Value="@Get(context)"
                            ValueChanged="@(value => Changed(value, context))" />
</FilterTemplate>
...
protected int? Get(FilterContext context)
{
       var searchValue = context.SearchValue;
       var hasFilter = int.TryParse(searchValue, out var filter);
       int? value = null;
       if (hasFilter)
       {
           value = filter;
       }
       return value;
}
protected void Changed(int? value, FilterContext context)
{
    var searchValue = value?.ToString();
    context.SearchValue = searchValue;
    context.TriggerFilterChange(searchValue);
}

@stsrki Do i something wrong?

@DDDenisSobek I reproduced it on my side and it seems it's a bug. I will put on backlog for next milestone.

Was this page helpful?
0 / 5 - 0 ratings