Hi,
I'm having a problem in a parent/child grid. My parent grid displays summary-type information. The child grid is editable. When I go to create a new row in the child grid, I need several bits of information from the parent grid row dataitem to display in my popup form template. I was searching around and found an example that accomplished the task this way:
function OnRequirementEdit(e) {
debugger;
var parentGrid = $("#grid").data("kendoGrid");
var detailGridId = "#requirementsgrid_" + e.model.IdString;
var detailGrid = $(detailGridId).data("kendoGrid");
var parentGridDataItem = parentGrid.dataItem(detailGrid.element.closest("tr"));
//Do stuff with the data from parentGridDataItem
}
The only problem is, I realized later that the data item was not from the detail grids parent row, but rather from the NEXT parent row down. So closest tr is actually finding the next one down. I tried to compensate by using detailGrid.element.prev("tr") but then I'm getting null for parentGridDataItem.
I should note, my client detail template is a tab control with 2 tabs and a grid on each tab (the second grid isn't of consequence because it's display only) but I'm not sure if that is causing issues navigating the DOM to get the parent tr.