Skip to content

Commit

Permalink
more filter overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
pwelter34 committed Nov 18, 2024
1 parent 5c14971 commit ad28024
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/LoreSoft.Blazor.Controls/Data/DataGrid.razor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Data;
using System.Linq.Dynamic.Core;

using LoreSoft.Blazor.Controls.Extensions;
Expand Down Expand Up @@ -63,7 +64,7 @@ public partial class DataGrid<TItem> : DataComponentBase<TItem>
[Parameter]
public QueryGroup Query { get; set; }

protected QueryGroup RootQuery { get; set; }
public QueryGroup RootQuery { get; set; }


public List<DataColumn<TItem>> Columns { get; } = [];
Expand Down Expand Up @@ -155,6 +156,19 @@ public async Task ApplyFilter(QueryRule rule)
await RefreshAsync(true);
}

public async Task RemoveFilters(Predicate<QueryRule> match)
{
RootQuery.Filters.RemoveAll(match);
await RefreshAsync(true);
}

public async Task RemoveFilter(string id)
{
RootQuery.Filters.RemoveAll(f => f.Id == id);
await RefreshAsync(true);
}


public override async Task RefreshAsync(bool resetPager = false, bool forceReload = false)
{
// clear row flags on refresh
Expand Down

0 comments on commit ad28024

Please sign in to comment.