Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.5k
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
When using the Grouping feature of MudDataGrid, I’d like to have a way for certain items to remain ungrouped. In my dataset, each entry has a GroupIdentifier property. For some entries, this property is not set. The issue is that these entries are still placed into an empty group, rather than appearing outside of any group. I’m not sure if I’ve missed an existing option for this, but I couldn’t find a way to let these items fall outside of grouping. My current code:
Example: here, PanelId falls into the string.Empty group (ignore the nonsense labels in this test): If I return null or omit custom GroupBy logic, it doesn’t throw (thanks tothis fix), but the result is worse because "null" is explicitly shown: What I’d like to achieve:
Mockup of the desired outcome when no-group on top: Is this possible to achieve? |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 2 comments 5 replies
-
BetaWas this translation helpful?Give feedback.
All reactions
-
Thank you for the suggestion. I believe it is a valid one, however the mass consensus was to create a null/empty GroupBy like you see in your samples. I do not think the complexity involved with allowing it to work both ways as a value proposition (opinion), however I do believe what you want is more possible than you think using Row Detail View (Hierarchy Columns). You would have to adjust your data to work with it but that would be minimal work and you can have each RowDetail have children as you wish (and create multiple groups within as you wish) Any additional thoughts? V |
BetaWas this translation helpful?Give feedback.
All reactions
-
I currently have a nested recursive component called
Currently, I avoid the PropertyColumn, if no item has GroupIdentifier in the given depth and generate the next layer if there are more Items of an item of this layer.
I'm not sure I get it right. So basically something like this?
Apart from extra styling, hiding headers, it still feels quite some effort to apply uniform column widths this way, but I'm really not sure if this is what you meant. Did you have something vastly different in mind? |
BetaWas this translation helpful?Give feedback.
All reactions
-
I was suggesting a 1 level hierarchy that handles the initial grouping, and then any additional grouping can be handled inside the rowdetailview. I did forget about the column alignment woes but I usually add some padding around the childrowcontent and leave the header of the child grid so I don't have to worry about it. That's a preference and yes your last example looks pretty close to what I was thinking. |
BetaWas this translation helpful?Give feedback.
All reactions
-
So your groupeddbvariable grid likely won't have the same woes and can just do regular grouping. If you have more than 1 then using hierarchy column that needs the special grouping you would almost have to be aligned or look odd. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Given the I haven't checked the code behind, so I might be wrong, but some Unfortunately, the |
BetaWas this translation helpful?Give feedback.
All reactions
-
No, that effort level would be probably be in line and acceptable. However, you could probably do this a bit more manually using GroupKeyPath with the public DataGrid method ToggleGroupExpand. https://mudblazor.com/api/datagrid#methods /// <summary>/// Represents a read-only, ordered collection of group key values forming a unique path through nested group levels./// Used to identify the exact group or subgroup location in multi-level group scenarios./// </summary>/// <remarks>/// Two <see cref="GroupKeyPath"/> instances are equal if they contain the same elements in the same order./// </remarks>publicclassGroupKeyPath(IList<object?>list):ReadOnlyCollection<object?>(list) Now I did not implement the GroupKeyPath, someone else did but the code is likely available now to either implement an InitiallyExpandedFunc or something do it manually.. |
BetaWas this translation helpful?Give feedback.