Reputation: 1681
At the transaction
level of the hierarchy, I need access to a value from the #grid
data. Can this be passed as a parameter or must I traverse the DOM using jQuery?
$(document).ready(function () {
var element = $("#grid").kendoGrid({
...
detailInit: summary
});
});
function summary(e) {
$("<div/>").appendTo(e.detailCell).kendoGrid({
...
detailInit: transactions
});
}
function tranasctions(e) {
$("<div/>").appendTo(e.detailCell).kendoGrid({
...
});
}
Upvotes: 0
Views: 797
Reputation: 21475
AFAIK, the detailInit
event only provides masterRow
property in its first argument object, which stands for the parent expanded row. So I'm afraid you'll have to traverse it. What I suggest is to store the masterRow
in a data
attribute in the second detail grid in order to find it in the last level:
Second level grid:
$(e.detailCell).kendoGrid({
// settings ...
}).data("master", e.masterRow);
This will create a data attribute named "master" with the first expanded row. Then in the third level you can retrieve it with:
var root = $(e.masterRow).closest(".k-detail-cell").data("master");
Upvotes: 1