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
90
Getting list of all expanded rows so that I can open them later
posted

I need to be able to get a list of rows (client side) that have been expanded, so that when a user reloads the page, I can then expand them.

I've seen code to get the expanded rows, but trying to expand them again, doesn't seem to work. I'm missing something obvious I'm sure.

This is the code that I found (on the forum) to get all the expanded rows:

 arrExpandedRows = $("#gridRRA").igHierarchicalGrid("allChildren");

This is what I was using to expand the rows (found in the forum):

for (i = 0; i < arrExpandedRows.length; i++){
var rowDom = $("#" + arrExpandedRows[i].id);
$("#gridRRA").igHierarchicalGrid("expand",rowDom);
}

Parents Reply Children
  • 0
    Offline posted in reply to Vasya Kacheshmarova

    Hello  I tired your code but after refresh the grid ... row is getting collapse

    function SetExpandedRows(gridName, expandedRowIds) {
    debugger;
    //Loop through the array of row id's
    for (var i = 0; i < expandedRowIds.length; i++) {
    //Get the reference to the row in the grid
    //var gridRow = $("#" + gridName).igGrid("rowById", expandedRowIds[i]);

    expandedRowIds.push($(this).attr("data-id"))
    localStorage.setItem("id", JSON.stringify(expandedRowIds));
    console.log(localStorage);
    if (localStorage) {
    debugger;
    $.each(JSON.parse(localStorage.getItem("id")), function () {
    var newEl = $("tr[data-id='" + this + "']");
    debugger;
    $("#" + gridName).igHierarchicalGrid("expand", newEl);
    });

    }