I currently have a grid with a single child grid instance. I would like to add a second child grid instance, I know this is possible because in the docs for Grid it says "Grid supports n level of child grids." yet I cannot find hope to initialize more than one child. How can I do this?
|
[app.component.html]
<div class="control-section">
<ejs-grid
#Grid
id="Grid"
[dataSource]="parentData"
(detailDataBound)="detailDataBound($event)"
>
<ng-template #detailTemplate>
<div class="childGrid1"></div>
<div class="childGrid2"></div>
</ng-template>
<e-columns>
---------------------------
</e-columns>
</ejs-grid>
</div>
[app.component.ts]
detailDataBound(args) {
var element1 = args.detailElement.querySelector('.childGrid1');
var child1Data = new DataManager(orderDatas).executeLocal(
new Query().where('EmployeeID', 'equal', args.data['EmployeeID'])
);
var childGrid1 = new Grid({
dataSource: child1Data,
height: 335,
width: 'auto',
columns: [
{ field: 'OrderID', headerText: 'Order ID', width: 110 },
{ field: 'CustomerID', headerText: 'Customer ID', width: 110 },
{ field: 'OrderDate', headerText: 'Order Date', width: 150 },
],
});
childGrid1.appendTo(element1);
var element2 = args.detailElement.querySelector('.childGrid2');
var child2Data = new DataManager(orderDatas).executeLocal(
new Query().where('EmployeeID', 'equal', args.data['EmployeeID'])
);
var childGrid2 = new Grid({
dataSource: child2Data,
height: 335,
width: 'auto',
columns: [
{ field: 'OrderID', headerText: 'Order ID', width: 110 },
{ field: 'CustomerID', headerText: 'Customer ID', width: 110 },
{ field: 'OrderDate', headerText: 'Order Date', width: 150 },
],
});
childGrid2.appendTo(element2);
}
|