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
920
Parent Child RelationShip - Add Child Record
posted

I am using the ighierarchical grid.

I am finding it difficult to access the parent grid row for a Child grid when Adding a new record to the child.

There is a primary key -  foreign key relationship between parent and child defined on the grid.

I need to access value(s) on the parent before I can create a new record on the child.

Can someone advise?

 

Thank You

 

Parents
  • 24671
    Suggested Answer
    posted

    hi,

    there are several ways to achieve this. One way would be to handle the expanding / expanded event for rows:

    $("#grid1").bind({ ighierarchicalgridrowexpanded: function (e, args) {
     var parentID = args.parentrow.attr("data-id");
    });
    Or if you have the child grid, you can get its parent in the following way:
    var id = $("#childGridElement").closest("tr").prev().attr("data-id");
    This will get the parent TR container of the child grid, and then get the previous sibling, which is the actual parent data row, which was expanded. 
    Hope it helps.
    Thanks,
    Angel
Reply Children
No Data