Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
555
How to expand all child bands
posted

Hi,

I have 3 bands of hierarchy in my grid. I am able to expand the first level but not able to expand the second level. I want my grid to look like below:

-R1

  - T1

       P1

But what I see is:

- R1

  + T1

I am using the following code:

function expandAllRowsOfGrid()

{

 // get the top level grid

var parentGrid = $("#igGrid").igHierarchicalGrid("rootWidget");

$(parentGrid.allRows()).each(function (index, element) {

     $("#igGrid").igHierarchicalGrid("expand", element);

     $(element).children().each(function (indexChild, elementChild) {

        $(element).igHierarchicalGrid("expand", elementChild);

          });

 });

}

$(element).igHierarchicalGrid("expand", elementChild); throws an exception.

Can you please suggest the correct way to open the second level.

Regards

S

Parents Reply
  • 17590
    Offline posted in reply to Singh

    Hello Singh,

    Hierarchical grid provides initialDataBindDepth option. As you may assume from the options name it sets how many levels of the grid will be initially loaded. Option`s default value is -1 which means that initially all levels are going to be bound. In this case if you have a parent without any children the grid won`t render the "+" sign for expanding. Alternatively, if you set this option to 1, for example, and the third level is the one without children the grid does not have information about the data in the lower levels and will render the "+" sing in all cases.

    I am attaching a small sample where the initialDataBindDepth option is not set (by default its is set to -1 which means that all data is loaded initially). In the third level there is no data respectively on the second level the "+" sign is not rendered. If you set the initialDataBindDepth option to 1 you may observe that in the second level the "+" sign is rendered.

    Pleas let me know if you have any additional questions regarding this matter.

    igHierarachicalGrid3Levels.zip
Children