How to get third level child data in Hierarchical grid using JQuery
New DiscussionHi Team,
I have created a hierarchical grid with 3 levels of data. I want to get the selected rows(Check box as row selector) data of third level on button click which is existing at second level.
I have tried below SelectedRows but getting error.
var childGrids = $(“#hierarchicalGrid1”).igHierarchicalGrid(“allChildren”);
if ($(“#hierarchicalgrid1”).data(“iggrid”) != null) {
var rows = $(“#hierarchicalgrid1”).iggridselection(“selectedRows”);
//do something
}
$.each(childgrids, function (ix, grid) {
var rows = $(grid).iggridselection(“selectedRows”);
$.each(rows, function (ix, row) {
// getting the child grid selected row cell data
rowid = row.element.attr(“data-id”);
var cellvalue = $(grid).iggrid(“getcellvalue”, parseint(rowid), “firstname”);
console.log(“child cell:” + cellvalue);
// getting the parent grid row data
var parentrow = $(grid).parents(“tr[data-container=’true’]”).prev(“tr”);
var parentrowid = $(parentrow).attr(“data-id”);
var parentrowgrid = $(parentrow).closest(“table”);
var parentcellvalue = $(parentrowgrid).iggrid(“getcellvalue”, parseint(parentrowid), “name”);
console.log(“parent cell:” + parentcellvalue);
});
});
Below is the error details.
Cannot Call methods on igGridSelection prior to Hierarchical grid Initialization; Attempted to call ‘selectedRows’
Is it possible to get the selected rows data from second level? If so please explain me with a sample.
Thank You!!