I have an parent child Telerik MVC grid. In the child grid I have a ComboBox. In the OnChange event of that comboBox, I need to lookup the value of something and populate another column in this edited row. If I already have child rows in this child grid, the following code will work to get the dataItem object of the parent row. However, if there are no child rows (I am just adding the first row), this does not work.
function ComboBox_OnChangeg(e)
{
var comboID = $("#combo").data('tComboBox').value();
var parentID = row.closest('.t-grid').data('tGrid').data[0].ParentID; // <--- IS NOT AN OBJECT!!!
// ajax call, blah blah
}
With no child rows in the child grid, how can I get the parent dataItem object and get the value of a column of the parent row?
Remember: This is the OnChange event of a ComboBox in a grid during in-line editing. This is NOT the OnEdit event of the grid.
Steve
Inspecting the page source, I discovered that the detail grid is rendered in a whole-table-spanning cell placed on the tr
following the master row tr
. So:
tr
ancestor with class t-detail-row
tr
with class t-master-row
pass the tr
found on step 2 to the dataItem
client side method of the master grid
var $masterRow = $comboElement.closest('tr.t-detail-row').prev('tr.t-master-row');
var masterData = $('#LieuLeconGrid').data('tGrid').dataItem($masterRow);