|
[Grid]
<ejs-grid #grid [dataSource]='parentData' [childGrid]='childGrid' (rowDataBound)='rowDataBound($event)' >
...
</ejs-grid>
[ts file]
import { fdata } from './datasource.spec';
...
export class FetchDataComponent {
...
ngOnInit(): void {
...
this.parentData = new DataManager({
url: '/api/Orders',
adaptor: new WebApiAdaptor,
offline: true
});
this.childGrid = {
dataSource: fdata,
queryString: 'ID',
...
};
}
rowDataBound(args: any) {
var filter = args.data.EmployeeID;
var dataQuery = new DataManager(fdata).executeLocal(new Query().where("ID", "equal", parseInt(filter), true));
if (dataQuery.length == 0) {
//here hide which parent row has no child records
args.row.querySelector('td').innerHTML = " ";
args.row.querySelector('td').className = "e-customizedExpandcell";
}
}
}
[Styles]
<style>
.e-row[aria-selected="true"] .e-customizedExpandcell {
background-color: #e0e0e0;
}
.e-customizedExpandcell {
}
.e-grid.e-gridhover tr[role='row']:hover {
background-color: #eee;
}
</style> |