Is it possible to also colapse the details grid if user just select another row without expanding it ?

I am using the code from this example here Expand mode to be single in Hierarchy grid and it works perfectly, but I would like to know if is it also possible to colapse the details grid if user just selected another row with out expanding it ?


1 Reply 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team July 25, 2022 05:50 AM UTC

Hi Ben,


Greetings from Syncfusion support.


The RowSelected event will be triggered when selecting a row in grid. Now in this event handler you can call the ExpandCollapseDetailRowAsync method to achieve this requirement. Please refer and use as like the codes below to achieve this requirement. We are also attaching a modified sample in this ticket.


 

<GridEvents DetailDataBound="DetailDataBound" RowSelected="RowSelected" DataBound="DataBound" TValue="EmployeeData"></GridEvents>

 

    public async Task RowSelected(RowSelectEventArgs<EmployeeData> args)

    {

        if (target != null)

        {

            await Grid.ExpandCollapseDetailRowAsync(target);

            target = null;

        }

    }

 


Reference :

https://blazor.syncfusion.com/documentation/datagrid/events#rowselected

https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_ExpandCollapseDetailRowAsync__0_


Please get back to us if you need further assistance.


Regards,

Renjith R


Attachment: SampleHGrid349566863_9f3c627.zip

Marked as answer
Loader.
Up arrow icon