Skip to content

Commit

Permalink
DataGrid column numeric advanced filter improved
Browse files Browse the repository at this point in the history
  • Loading branch information
enchev committed Nov 15, 2024
1 parent cbb292b commit 124033d
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions Radzen.Blazor/RadzenDataGrid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -807,34 +807,7 @@ internal RenderFragment DrawNumericFilter(RadzenDataGridColumn<TItem> column, bo
builder.AddAttribute(3, "Change", eventCallbackGenericCreate.Invoke(this,
new object[] { this, eventCallbackGenericAction.Invoke(this, new object[] { action }) }));

if (FilterMode == FilterMode.Advanced)
{
builder.AddAttribute(4, "oninput", EventCallback.Factory.Create<ChangeEventArgs>(this, args =>
{
var value = $"{args.Value}";
object filterValue = null;

if (!string.IsNullOrWhiteSpace(value))
{
try
{
filterValue = Convert.ChangeType(value, Nullable.GetUnderlyingType(type));
}
catch (Exception)
{
filterValue = null;
}
}

column.SetFilterValue(filterValue, isFirst);
SaveSettings();
}));
builder.AddAttribute(5, "Disabled", !column.CanSetFilterValue());
}
else if (FilterMode == FilterMode.SimpleWithMenu)
{
builder.AddAttribute(4, "Disabled", !column.CanSetFilterValue());
}
builder.AddAttribute(4, "Disabled", !column.CanSetFilterValue());

builder.CloseComponent();
});
Expand Down

0 comments on commit 124033d

Please sign in to comment.