-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MudDataGrid: Allow overriding default filter operators per column #10254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #10254 +/- ##
==========================================
+ Coverage 91.54% 91.56% +0.01%
==========================================
Files 415 415
Lines 13017 13025 +8
Branches 2457 2460 +3
==========================================
+ Hits 11917 11926 +9
+ Misses 549 547 -2
- Partials 551 552 +1 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good, aside from the small improvement in GetFilterOperators.
| } | ||
| else | ||
| { | ||
| return [.. FilterOperators]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems unnecessary to use a collection expression here. You can just use FilterOperators.ToArray() which is much lighter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just use
FilterOperators.ToArray()which is much lighter.
I think that's pretty much the same.
Can't we just use IReadOnlyCollection? Then no ToArray is needed that will allocate since HashSet implements it
I don't think we need access by indexer here?
I would say IReadOnlyCollection > Array most of the time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not the same. Although, it is a small difference. I do agree that IReadOnlyCollection here would prevent the need for a conversion to an array. The collection expression just leads to unnecessary IL is all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not the same. Although, it is a small difference.
You are right, actually I looked in sharplab and it generates
private string[] Array
{
get
{
HashSet<string> filterOperators = FilterOperators;
int num = 0;
string[] array = new string[filterOperators.Count];
HashSet<string>.Enumerator enumerator = filterOperators.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
string text = (array[num] = enumerator.Current);
num++;
}
return array;
}
finally
{
((IDisposable)enumerator).Dispose();
}
}
}
for HashSet. I really thought expression collection is more smarter and would fallback to simple .ToArray lol.
|



Description
Added a
FilterOperatorsproperty to the data gridColumn. If supplied, these operators would be used instead of the defaultTypeoperators. This allows developers to control the filter operators available to the end user.Note: New operators cannot be created, the must already exist in the list of default operators.
Resolves #8996
How Has This Been Tested?
Visually and Unit Tests
Type of Changes
Checklist
dev).