flexgrid sub-levels coming open

Posted by: ednaldosoares on 26 March 2019, 6:17 am EST

  • Posted 26 March 2019, 6:17 am EST

    Hello, I'm having a hard time setting up my flexgrid.


    I need to have my sub-levels come with + CLOSED as shown in figure IMAGE1

    my code
    c1FlexGrid.Tree.Show (0);

    this makes me the first level come closed, when I click on the +, the sub-levels come all open, I needed them to come all closed, as the user wishes, it opens.


    In IMAGE 2 it shows how it came open, and IMAGE 3 shows how it should be.

    Can someone help me?
  • Marked as Answer

    Replied 26 March 2019, 5:12 pm EST

    Hello,

    This is by-design behavior.
    Invoking Tree.Show(level) method expands nodes up to that level and collapses the next level. Hence, you are seeing all nodes up to level0 expanded and level1 collapsed.

    To meet your requirement, there are few ways:
    1. You may call the Tree.Show method for each level of Subtotal Row in descending order as follows:
    c1FlexGrid1.Tree.Show(2);
    c1FlexGrid1.Tree.Show(1);
    c1FlexGrid1.Tree.Show(0);
    2. You may do collapse the sub-nodes at run time. For this, use BeforeCollapse event as follows:
    private void C1FlexGrid1_BeforeCollapse(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
    {
    if(c1FlexGrid1.Rows[e.Row].IsNode)
    {
    var node = c1FlexGrid1.Rows[e.Row].Node;
    foreach (C1.Win.C1FlexGrid.Node subNodes in node.Nodes)
    {
    subNodes.Collapsed = true;
    }
    }
    }

    Best Regards,
    Ruchir
Need extra support?

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

Learn More

Forum Channels