Skip to content

Commit

Permalink
Force DataGrid advanced numeric filter value on apply only for defaul…
Browse files Browse the repository at this point in the history
…t UI
  • Loading branch information
enchev committed Nov 29, 2024
1 parent 11f9e5c commit eda3702
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Radzen.Blazor/RadzenDataGridHeaderCell.razor
Original file line number Diff line number Diff line change
Expand Up @@ -340,16 +340,22 @@ else
{
if (PropertyAccess.IsNumeric(Column.FilterPropertyType) && !(PropertyAccess.IsEnum(Column.FilterPropertyType) || PropertyAccess.IsNullableEnum(Column.FilterPropertyType)))
{
var firstInputValue = await Grid.GetJSRuntime().InvokeAsync<string>("Radzen.getNumericValue", Grid.getFilterInputId(Column) + "f");
if (!object.Equals($"{Column.GetFilterValue()}", firstInputValue))
if (Column.FilterValueTemplate == null)
{
Column.SetFilterValue(!string.IsNullOrEmpty(firstInputValue) ? Convert.ChangeType(firstInputValue, Column.FilterPropertyType) : null);
var firstInputValue = await Grid.GetJSRuntime().InvokeAsync<string>("Radzen.getNumericValue", Grid.getFilterInputId(Column) + "f");
if (!object.Equals($"{Column.GetFilterValue()}", firstInputValue))
{
Column.SetFilterValue(!string.IsNullOrEmpty(firstInputValue) ? Convert.ChangeType(firstInputValue, Column.FilterPropertyType) : null);
}
}

var secondInputValue = await Grid.GetJSRuntime().InvokeAsync<string>("Radzen.getNumericValue", Grid.getFilterInputId(Column) + "s");
if (!object.Equals($"{Column.GetSecondFilterValue()}", secondInputValue))
if (Column.SecondFilterValueTemplate == null)
{
Column.SetFilterValue(!string.IsNullOrEmpty(secondInputValue) ? Convert.ChangeType(secondInputValue, Column.FilterPropertyType) : null, false);
var secondInputValue = await Grid.GetJSRuntime().InvokeAsync<string>("Radzen.getNumericValue", Grid.getFilterInputId(Column) + "s");
if (!object.Equals($"{Column.GetSecondFilterValue()}", secondInputValue))
{
Column.SetFilterValue(!string.IsNullOrEmpty(secondInputValue) ? Convert.ChangeType(secondInputValue, Column.FilterPropertyType) : null, false);
}
}
}

Expand Down

0 comments on commit eda3702

Please sign in to comment.