Handle click event of expand (+) and collapsed (-) for group in C1DataGrid

Posted by: Swapnil.Walwadkar on 20 November 2023, 4:32 pm EST

  • Posted 20 November 2023, 4:32 pm EST - Updated 20 November 2023, 4:37 pm EST

    Hello Component One Team,

    I have a query regarding expanding/collapsing of a group in C1DataGrid.

    In attached image (Grid.PNG), we want to handle click event for expand (+) and collapsed (-) for group.

    Could you please provide us inputs on how we can get this event handler.

    Thank you,

    Swapnil Walwadkar

  • Posted 21 November 2023, 3:32 pm EST

    Hi,

    Thanks for reaching out to us with your query.

    You can achieve this requirement by handling GroupRowsVisibilityChanged event for all GroupRows as:

    var grpRows = grid.Rows.Where(x => x.GetType() == typeof(DataGridGroupRow)).ToList();
    foreach (DataGridGroupRow grpRow in grpRows)
    {
        grpRow.GroupRowsVisibilityChanged += (s1, e1) =>
        {
            Debug.WriteLine("Group Row: " + (s1 as DataGridGroupRow).GetGroupText() + " is " + e1.NewValue.ToString());
        };
    }

    Please refer the attached sample for the same: DataGridGroup.zip

    Best Regards,

    Nitin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels