[scrolling.html]
<ejs-grid #grid [dataSource]='data' (dataBound)='dataBound($event)' height='400'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' width='150' textAlign='Right'></e-column>
<e-column field='CustomerName' headerText='Customer Name' width='160'></e-column>
<e-column field='OrderDate' headerText='Order Date' format="yMd" width='155' textAlign='Right'></e-column>
<e-column field='Freight' headerText='Freight' width='130' format='C2' textAlign='Right'></e-column>
<e-column field='ShippedDate' headerText='Shipped Date' format="yMd" width='155' textAlign='Right'></e-column>
</e-columns>
</ejs-grid>
---------------------------------------------------------------------------------------------------------------------
[scrolling.component.ts]
public dataBound(args) : void{
if (this.grid.currentViewData.length * this.grid.getRowHeight() < parseInt(this.grid.height)) {
var hdTable = this.grid.getHeaderContent();
hdTable.style.paddingRight = ''
document.querySelector('.e-grid .e-content').style.overflowY = 'auto';
}
else {
var hdTable = this.grid.getHeaderContent();
hdTable.style.paddingRight = '16px';
document.querySelector('.e-grid .e-content').style.overflowY = 'scroll';
}
}
|