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
750
Expand / Collapse Group Rows
posted

I have searched on this and found ExpandAll() and CollapseAll() but these are not working in response to server-side button click.  I want to have buttons - Expand All and Collapse All that will perform this function.  If this can be done in javascript client-side that would be preferred.

This is not working either:

function collapseAll() {

var grid = $find("hgrid");

var groupRow = grid.get_gridView().get_groupRows().get_row(0);

var row;

for (var i = 0; i < groupRow.get_rows().length; i++) {

row = groupRow.get_rows()[i];

row.groupRow.collapseAll();

}

}

Parents
  • 20255
    Verified Answer
    Offline posted

    Hello,

    Thank you for contacting us!

    Below you will find a sample which is showing exactly this, how to expand/collapse all WHDG rows with one click.

    Code snippet:

    //
     function ToggleRows(expandOrCollapse) {
      var grid = $find('WebHierarchicalDataGrid1');

      var rowsLength = grid.get_gridView().get_rows().get_length();

      for (var i = 0; i
       grid.get_gridView().get_rows().get_row(i).set_expanded(expandOrCollapse);
      }

      for (var i = 0; i
       grid.get_gridView().get_groupRows().get_row(i).set_expanded(expandOrCollapse);
      }
     }
    // ]]>

    ExpandCollapseRows(Also grouped rows).zip
Reply Children