[index.html]
<template>
<require from="./grid-wrapper"></require>
<div>
<ej-grid e-data-source.bind="gridData" e-on-details-data-bound.trigger="detailGridData($event)" e-details-Template="#ChildGridContents">
. . .
</ej-grid>
</div>
<div>
<script id="ChildGridContents" type="text/template">
<div id="detailGrid"+${EmployeeID}>
</div>
</script>
</div>
</template>
[index.js]
export class Grid {
constructor() {
this.gridData = [{EmployeeID:1, FirstName: "David",Order:[{OrderID:100,ShipCity:"Reims"}]},
{EmployeeID:2, FirstName: "Doe", Order:[{OrderID:101,ShipCity:"Rio de Jeniro"}]},
{EmployeeID:3, FirstName: "John", Order:[{OrderID:102,ShipCity:"Reims"},
{OrderID:103,ShipCity:"Los Angels"}]}];
}
detailGridData(e) {
var childData = e.data.Order;
e.detailsElement.find("#detailGrid").ejGrid({
dataSource: childData,
. . .
});
}
}
|