Repository: Megabit/Blazorise (2026-03-31T13:12:26Z)

Issue:
[Bug]: DataGrid grouping broken for more than 1 level of grouping
### Blazorise Version

2.0.3

### What Blazorise provider are you running on?

Bootstrap5

### Link to minimal reproduction or a simple code snippet

https://blazorise.com/docs/extensions/datagrid/features/grouping

### Steps to reproduce & bug description

In any one of the Demos, more than 1 level of grouping does not show the items grouped.

For example Gender and Active are shown grouped, but they do not display in the datagrid grouped. Gender is grouped, but active is not

<img width="1162" height="744" alt="Image" src="https://github.com/user-attachments/assets/576e7cd8-f3f1-4f67-9cae-901a723d12b8" />

### What is expected?

All levels of grouping should group

### What is actually happening?

Only first level of grouping works

### What browsers do you see the problem on?

Microsoft Edge

### Any additional comments?

_No response_


Discussion:

Patch:
diff --git a/Source/Extensions/Blazorise.DataGrid/DataGrid.razor.cs b/Source/Extensions/Blazorise.DataGrid/DataGrid.razor.cs
index 4a5bf16a0c..75ac53eaa0 100644
--- a/Source/Extensions/Blazorise.DataGrid/DataGrid.razor.cs
+++ b/Source/Extensions/Blazorise.DataGrid/DataGrid.razor.cs
@@ -1,4 +1,4 @@
-﻿#region Using directives
+#region Using directives
 using System;
 using System.Collections.Generic;
 using System.Collections.Specialized;
@@ -1062,7 +1062,7 @@ private void GroupDisplayData()
             } )
             .ToList();
 
-            GroupSyncState( groupedData, newGroupedData );
+            RecursiveGroup( 1, groupedData, newGroupedData );
             groupedData = newGroupedData;
         }
         else


Test patch:
diff --git a/Tests/Blazorise.Tests/Components/DataGridGroupingComponentTest.cs b/Tests/Blazorise.Tests/Components/DataGridGroupingComponentTest.cs
index 7f4ab25f9e..35989ae8a6 100644
--- a/Tests/Blazorise.Tests/Components/DataGridGroupingComponentTest.cs
+++ b/Tests/Blazorise.Tests/Components/DataGridGroupingComponentTest.cs
@@ -141,4 +141,39 @@ public async Task LoadState_Should_Not_Raise_GroupingChanged_Event()
             groupingChanged.Should().BeEmpty();
         }, TimeSpan.FromSeconds( 3 ) );
     }
+
+    [Fact]
+    public void DisplayGroupedData_Should_CreateNestedGroups_When_MultipleColumnsAreGrouped()
+    {
+        // setup
+        IEnumerable<Employee> data = new[]
+        {
+            new Employee { Name = "John", Department = "Engineering", City = "Zagreb" },
+            new Employee { Name = "John", Department = "Sales", City = "Rijeka" },
+            new Employee { Name = "Ana", Department = "Engineering", City = "Split" },
+        };
+
+        var comp = RenderComponent<BasicTestApp.Client.DataGridGroupingComponent>( parameters =>
+        {
+            parameters.Add( x => x.Data, data );
+        } );
+
+        var dataGrid = comp.FindComponent<DataGrid<Employee>>();
+        var columns = dataGrid.FindComponents<DataGridColumn<Employee>>();
+        var nameColumn = columns.Single( x => x.Instance.Field == nameof( Employee.Name ) );
+        var departmentColumn = columns.Single( x => x.Instance.Field == nameof( Employee.Department ) );
+
+        // test
+        dataGrid.Instance.AddGroupColumn( nameColumn.Instance );
+        dataGrid.Instance.AddGroupColumn( departmentColumn.Instance );
+
+        var groupedData = dataGrid.Instance.DisplayGroupedData.ToList();
+        var johnGroup = groupedData.Single( x => x.Key == "John" );
+        johnGroup.NestedGroup.Should().NotBeNull();
+        var nestedGroups = johnGroup.NestedGroup!.ToList();
+
+        // validate
+        groupedData.Should().HaveCount( 2 );
+        nestedGroups.Select( x => x.Key ).Should().Equal( "Engineering", "Sales" );
+    }
 }
\ No newline at end of file