Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Mimeo.DynamicUI.Blazor/Forms/ODataGrid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ public partial class ODataGrid
[Parameter]
public Dictionary<string, Type> CustomFormFieldTypes { get; set; } = [];

[Parameter]
public EventCallback<DataQuery> OnQueryChanged { get; set; }

private bool CanCreate => (Service?.SupportsCreate ?? false) && AllowCreate;
private bool CanUpdate => (Service?.SupportsUpdate ?? false) && AllowUpdate;
private bool CanCopy => (Service?.SupportsCopy ?? false) && AllowCopy;
Expand Down Expand Up @@ -248,6 +251,8 @@ await taskRunningService.Run(async () =>
});

previousQuery = query.Clone();

await OnQueryChanged.InvokeAsync(previousQuery);
}

private async Task LoadSearchSuggestions(LoadDataArgs args)
Expand Down
3 changes: 2 additions & 1 deletion Mimeo.DynamicUI/Data/DataPageEnumerable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ private static PageQuery<T> CreateQuery(DataQuery args, Func<DataQuery, Task<Dat
var skip = continuationToken as int? ?? 0;
var newArgs = new DataQuery
{
Filters = args.Filters,
Filter = args.Filter,
Sorts = args.Sorts,
SearchText = args.SearchText,
Skip = skip,
Top = args.Top ?? 250
};
Expand Down
8 changes: 4 additions & 4 deletions Mimeo.DynamicUI/Data/DataQuery.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Mimeo.DynamicUI.Data
namespace Mimeo.DynamicUI.Data
{
public class DataQuery
{
Expand Down Expand Up @@ -39,7 +39,7 @@ public DataQuery Clone()
Skip = this.Skip,
Top = this.Top,
SearchText = this.SearchText,
Filters = this.Filters.Select(f => f.Clone()).ToList(),
Filter = (DataQueryFilterGroup)this.Filter.Clone(),
Sorts = this.Sorts.Select(f => f with { } /* clone a record*/).ToList()
};
}
Expand All @@ -54,13 +54,13 @@ public override bool Equals(object? obj)
return this.Skip == other.Skip
&& this.Top == other.Top
&& this.SearchText == other.SearchText
&& this.Filters.SequenceEqual(other.Filters)
&& this.Filter.Equals(other.Filter)
&& this.Sorts.SequenceEqual(other.Sorts);
}

public override int GetHashCode()
{
return HashCode.Combine(Skip, Top, SearchText, Filters, Sorts);
return HashCode.Combine(Skip, Top, SearchText, Filter, Sorts);
}

public static bool operator ==(DataQuery? left, DataQuery? right)
Expand Down
3 changes: 2 additions & 1 deletion Mimeo.DynamicUI/Data/DataQueryFilterGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public override DataQueryFilterBase Clone()
{
return new DataQueryFilterGroup
{
Filters = Filters.Select(f => f.Clone()).ToList()
Filters = Filters.Select(f => f.Clone()).ToList(),
FiltersConjunction = FiltersConjunction
};
}

Expand Down
Loading