(headerCellInfo)='headerCellInfo($event)'
headerCellInfo(args: any) {
const toolcontent = args.cell.column.headerText;
const tooltip: Tooltip = new Tooltip({
content: toolcontent
});
tooltip.appendTo(args.node);
}
<e-column
[field]="column.field"
[headerText]="column.headerName"
[matTooltip]="column.headerName"
|
[app.component.html]
<ejs-tooltip id='tooltip' target=".customcss" position="LeftTop">
<ejs-grid #grid [dataSource]='data'(load)='load($event)' allowFiltering={true}>
<e-columns>
<e-column field='EmployeeID' headerText='Employee ID' width='125' textAlign='Right'></e-column>
<e-column field='FirstName' headerText='Name' [customAttributes]='customAttributes' width='120'></e-column>
<e-column field='Title' headerText='Title' width='170'></e-column>
<e-column field='HireDate' headerText='Hire Date' width='135' textAlign='Right' format='yMd'></e-column>
<e-column field='ReportsTo' headerText='Reports To' width='120' textAlign='Right'></e-column>
</e-columns>
</ejs-grid>
</ejs-tooltip>
[app.component.ts]
ngOnInit(): void {
this.data = employeeData;
this.customAttributes = {class: 'customcss'};
}
load(args) {
this.grid.element.addEventListener("mouseover", function (args) {
if ( args.target.classList.contains("customcss")) {
var tooltip = document.getElementById('tooltip').ej2_instances[0];
tooltip.content = args.target.innerText;
}
});
} |