@Component({
selector: 'app-container',
template: `<ejs-grid [dataSource]='data' [allowPaging]='true' [allowGrouping]='true' [allowSorting]='true' [pageSettings]='pageOptions'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
<e-column field='ShipCity' headerText='Ship City' width=150></e-column>
<e-column field='ShipName' headerText='Ship Name' width=150></e-column>
</e-columns>
</ejs-grid>`
})
export class AppComponent implements OnInit {
public data: DataManager;
public pageOptions = { pageSize: 7 };
ngOnInit(): void {
this.data = new DataManager({
url: 'Home/UrlDataSource',
adaptor: new UrlAdaptor,
offline: true
});
}
} |
ngOnInit(): void {
this.stTime = performance.now();
this.data = new DataManager({
...
}
ngAfterViewInit(): void {
this.grid.element.addEventListener('DOMSubtreeModified', () => {
if (this.stTime && this.isDataChanged) {
this.isDataChanged = false;
let val: any = (performance.now() - this.stTime).toFixed(0);
console.log(val);
}
});
} |