<div class="control-section">
<button (click)='handleClick($event)'type='button'>DataUpdate</button>
<div *ngFor="let item of array">
<ejs-grid #grid [dataSource]='item.firstName'>
</ejs-grid>
</div>
</div>
|
export class AppComponent {
public data: Object[] = [];
@ViewChildren(GridComponent) grids !: QueryList<GridComponent>;
// define unique id to each object to define it to grid.
public array: [object] = [
{ firstName: orderDetails.slice(0,4) },
{ firstName: orderDetails.slice(5,10) },
{ firstName: customerData.slice(0,4) }
];
ngOnInit(): void {
}
handleClick(){
for(var i=0;i<this.array.length;i++){
this.array[i].firstName.push({ OrderID: 10252, CustomerName: "VINET", Freight: 55.55,CustomerID: "VINET",ContactName: "Sam", Country: "INDIA", Address: "Check" }); // updating the dataSorce
}
this.grids.forEach(div => div.refresh()); // refresh each grid
}
}
|