Skip to content

Infragistics Community Forum / Web / Ignite UI for jQuery / How to get third level child data in Hierarchical grid using JQuery

How to get third level child data in Hierarchical grid using JQuery

New Discussion
Infosys DEV Team
Infosys DEV Team asked on Apr 30, 2016 12:24 AM

Hi 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!!

 

Sign In to post a reply

Replies

  • 0
    [Infragistics] Michael H.
    [Infragistics] Michael H. answered on Apr 30, 2016 12:24 AM

    Hi Chandana Tayi,

    Thank you for posting in our forums!

    The code you provided will traverse up the DOM and get the parent row information along with the currently selected child rows.  Since the igHierarchcialGrid can only have selected rows in one child grid at a time, using your code should give you the desired results unless I am misunderstanding your requirements.

    I have modified your code mostly to account for some capitalization issues.  Please check out my jsFiddle here.  Clicking on the button will output the selected child rows in the console.

    If you have any further questions or concerns with this, please let me know.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Infosys DEV Team
Favorites
0
Replies
1
Created On
Apr 30, 2016
Last Post
9 years, 10 months ago

Suggested Discussions

Created by

Created on

Apr 30, 2016 12:24 AM

Last activity on

Feb 19, 2026 9:26 PM