on clicking the add icon the following code will execute
//Function called after adding the child data
public addChildInventory(){
// service to update the child data in db
this.inventorydataService.addChildInventory(childData , this.rowData.rowData.id).
subscribe(data => {
this.getInventoryData();
this.grid.refresh();
});
}
}
and getInventoryData() function will get all the data values. The code of this function is
if(tabdata.length > 0){
this.showData = true;
this.data=tabdata;
this.parentData=this.data;
this.childGrid= {
queryString: 'Key',
columns: [
{ field: 'Category', headerText: 'Category'},
{ field: 'Ipaddress', headerText: 'Ipaddress'},
{ field: 'Subnet', headerText: 'Subnet'},
],
};
i am using onload() function to get the child data
public onLoad(): void {
let child = [];
(this.grid.dataSource as object[]).forEach((e)=>{
child = child.concat(e['SubCategory']);
});
this.grid.childGrid.dataSource = child;
}