I have been trying to find a way to only show one row detail expanded at a time. I found some code in Kendo UI for jquery but it does not see to work. Does anyone have any idea what I am doing wrong?
var
lastContactId;
function
onShowDetail(e) {
lastContactId = e.sender.dataItem(e.masterRow).ContactId;
// collapse all but current
var
currentRow = e.masterRow;
var
grid = $(
'#grid_client_contact'
).data(
'kendoGrid'
);
var
masterRows = grid.table.find(
'tr.k-master-row'
);
console.log(masterRows);
var
mappedRows = $.map(masterRows,
function
(row, rowIndex) {
if
($(row).find(
"a.k-minus"
).length > 0 && !$(row).is(currentRow)) {
console.log(row);
return
$(row);
}
return
null
;
});
console.log(mappedRows.length);
for
(
var
i = 0; i < mappedRows.length; i++) {
grid.collapseRow(mappedRows[i]);
console.log(i);
}
}