Grouping Columns in TreeGrid

Hello,

I am trying to duplicate the following grid in my Blazor application using Syncfusion TreeGrid. Is there any way to group columns like shown in the below picture? The pictured grid was created in Excel.

There is one group for ICE, second group for Bloomberg and so on.

Any example you could provide would be highly appreaciated.

Thank you very much,

Yoshiro




1 Reply

PS Pon Selva Jeganathan Syncfusion Team November 28, 2022 01:56 PM UTC

Hi Yoshiro,


Query: Is there any way to group columns like shown in the below picture?


We achieved your requirement by using the stacked header column feature of the Tree Grid. Using this feature, you can stack or group the column headers of the treegrid. It can be done by setting the TreeGridColumns -> TreeGridColumns property.


Please refer to the below code example,


<SfTreeGrid IdMapping="ID" ParentIdMapping="ParentID" DataSource="@TreeGridData" TreeColumnIndex="1" AllowResizing="true">

    <TreeGridColumns>

        <TreeGridColumn HeaderText="Order Details" TextAlign="Syncfusion.Blazor.Grids.TextAlign.Right">

            <TreeGridColumns>

                <TreeGridColumn Field="ID" Width="110" HeaderText="Order ID" TextAlign="Syncfusion.Blazor.Grids.TextAlign.Right"></TreeGridColumn>

                <TreeGridColumn Field="Name" Width="220" HeaderText="Order Name" TextAlign="Syncfusion.Blazor.Grids.TextAlign.Left"></TreeGridColumn>

                <TreeGridColumn Field="OrderDate" Width="120" HeaderText="Order Date" TextAlign="Syncfusion.Blazor.Grids.TextAlign.Right" Format="yMd" Type="Syncfusion.Blazor.Grids.ColumnType.Date"></TreeGridColumn>

            </TreeGridColumns>

        </TreeGridColumn>

……

        </TreeGridColumn>

    </TreeGridColumns>


In the above code snippet, the columns Order ID, Order Name, Order Date are grouped under Order Details, the columns Shipment Category, Shipped Date, Units are grouped under Shipment Details and Price per Unit, Total Price, Price are grouped under Price details.


Please refer to the below screenshot,




Please refer to the below help documentation,

https://blazor.syncfusion.com/documentation/treegrid/columns/column-resizing?cs-save-lang=1&cs-lang=csharp#resize-stacked-column


Regards,

Pon selva


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.




Loader.
Up arrow icon