|
App.component.html
<ejs-grid #grid id='Grid' [dataSource]='data' height='272px' [allowPaging]=true
(dataBound)="dataBound($event)">
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150>
<ng-template #headerTemplate let-data>
<span>
<div> Customer ID
</div>
<div> Customer Name
</div>
</span>
</ng-template>
</e-column>
<e-column field='ShipName' headerText='ShipName' width=150></e-column>
<e-column field='ShipCity' headerText='Ship City' width=150></e-column>
</e-columns>
</ejs-grid>
<style>
.e-grid .e-headercell {
padding: 10px 21px 10px; // set the paddings in header
}
</style>
App.component.ts
export class AppComponent implements OnInit {
@ViewChild('grid', { static: true }) public grid: GridComponent;
public data: object[];
ngOnInit(): void {
this.data = hierarchyOrderdata;
}
dataBound(args){
// get the headercelldiv elements
var headercelldiv = this.grid.element.getElementsByClassName("e-headercelldiv");
for (var i=0; i<headercelldiv.length; i++){
// set the height as auto
headercelldiv[i].style.height = 'auto';
};
}
}
|