Hello,
The problem I'm facing is that we a hierarchical grid with one layer of data-depth (so each parent row has 1 child grid). The problem is we want to determine on click of each of the rows and determine whether it was from the parent grid or one of the child grid rows and grab said row's data id. I have used an example from another thread on how to get the id on double-click like so:
$(gridName).dblclick(function(event) { var row = $(event.target).closest('tr'); // Finds the active row // clicked var key = row.attr("data-id"); // Obtains the primary key of the row});
Based on the dblclick event, what is the best practice to differentiate if the tr is from the parent grid or one of the sub-grids?
Thanks.
Hello Patrick,
On each click on a row or cell of an igHierarchicalGrid, a corresponding event is triggered. For the row, we have the rowSelectionChanging / rowSelectionChanged event. The Selected rows will be available at this event. We may distinguish a child's selected row and the parent's selected row as the following forum thread suggested:
http://ko.infragistics.com/community/forums/t/71232.aspx
Please let me know if this is a feasible option, or otherwise.
If you have any questions, please let me know as well.
In addition, if the currently selected row is not in the children's selected rows, it is a Parent row.
I hope this helps.
Thank you for the update.
I will be communicating with you through the case regarding the subgrids.
I am just following up and see if you have any questions.
Hello Vivian,
No current questions, as I have not been able to verify this as I am focusing on my problem in Support Case: CAS-98782-P8H2Z7 and this forum thread:
http://ko.infragistics.com/community/forums/p/72917/370280.aspx.
I have been able to use the Selection feature to obtain on-click events for a row, but have not tested it with child-grid rows yet.
Hi Patrick
once you have the row's TR, you can easily differentiate if it's coming from the root grid, or from a child grid:
var isRootRow = $(tr).closest("table").hasClass("ui-iggrid-root");
if your TR is already a jQuery object, wrapping it in $() is not necessary.
Let me know if you have any questions. Thanks
Angel
Thanks, Angel. I was able to figure this out!