[app.component.html]
<ejs-grid
#grid
id="Grid"
[dataSource]="parentData"
[childGrid]="childGrid"
(dataBound)="dataBound($event)"
(detailDataBound)="detailDataBound($event)"
>
------
</ejs-grid>
[app.component.ts]
export class AppComponent {
----
dataBound(args) {
// on the internal event of detail-state-change
this.grid.on("detail-state-change", function(args) {
// triggered each time when we collapse and expand the rendered child Grid
console.log(args);
});
}
detailDataBound(args) { // triggered at initial expanding of child-Grid
console.log(args);
}
}
|
[app.component.ts]
detailDataBound(args) {
console.log(args);
// load the data to the expanded childGrid
args.childGrid.dataSource = new DataManager({
url:
adaptor: new ODataAdaptor(),
crossDomain: true
});
}
|
[app.component.html]
<ejs-grid
#grid
id="Grid"
[dataSource]="parentData"
----
>
----
</ejs-grid>
[app.component.ts]
import { Component, OnInit, ViewChild, ViewEncapsulation } from "@angular/core";
-----
export class AppComponent {
@ViewChild("grid", { static: true }) // create the viewchild instance using element name (‘#grid’)
public grid: GridComponent;
-----
}
|