MudBlazor/MudBlazor

DataGrid: Support server side grouping when using ServerData property

Open

#9,295 opened on Jul 2, 2024

View on GitHub
 (12 comments) (3 reactions) (0 assignees)C# (1,631 forks)batch import
enhancementhelp wanted

Repository metrics

Stars
 (10,394 stars)
PR merge metrics
 (Avg merge 6d 6h) (108 merged PRs in 30d)

Description

Feature request type

Enhance component

Component name

DataGrid

Is your feature request related to a problem?

No response

Describe the solution you'd like

When using MudDataGrid with the ServerData feature like so:

<MudDataGrid ServerData="LoadGridData">

The GridState<T> object does not provide any GroupDefinitions. Therefore its not possible to apply grouping on the server side. Currently, the grid naively only groups client side. However, when using server side paged results, this does not make sense as it will only group on data of the current page.

To make this work, the following changes have to be implemented (roughly outlined, not detailed):

  • GridState<T> needs to have a property GroupDefinitions which includes the currently grouped columns
  • GridData<T> needs to have a property GroupedItems of type IEnumerable<IGrouping<string, T>>? GroupedItems which includes the currently grouped items
  • Grid should render already grouped server side data and should not group on client side at all.

Have you seen this feature anywhere else?

No response

Describe alternatives you've considered

No response

Pull Request

  • I would like to do a Pull Request

Code of Conduct

  • I agree to follow this project's Code of Conduct

Contributor guide