Collapse specific rows on load

Hi,


I like to have some rows collapssed in my TreeGrid on load. But not all, it depends on the row content.

For my first approach I used the RowDataBound. For the first look this seems to work, every row we liked to be collapsed is collapsed. BUT it is not possible to expand these rows anymore.

How to collapse just for the first time everything is rendered


1 Reply

SM Shek Mohammed Asiq Abdul Jabbar Syncfusion Team December 15, 2025 04:20 PM UTC

Hi Alexander Kuhlmann,


Greetings from Syncfusion support.


We understand that you would like to collapse records during the initial rendering of the TreeGrid. You can achieve this by using the ExpandStateMapping property, which allows you to control the default expand/collapse state of each record.


Sample:
https://blazorplayground.syncfusion.com/LjhoMVWeyCDtqocp


API Reference:
https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.TreeGrid.SfTreeGrid-1.html#Syncfusion_Blazor_TreeGrid_SfTreeGrid_1_ExpandStateMapping


If you have any additional requirements or need further assistance, please let us know. We will be happy to help you.


Regards,

Shek


Loader.
Up arrow icon