@Component({
selector: 'app-container',
template: `<ejs-grid #grid [dataSource]='data' [height]='315' (queryCellInfo)='tooltip($event)' >
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=90></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=120></e-column>
<e-column field='Freight' headerText='Freight' textAlign='Right' format='C2' width=90></e-column>
<e-column field='ShipName' headerText='Ship Name' width=120></e-column>
</e-columns>
</ejs-grid>`
})
export class AppComponent implements OnInit {
public data: Object[];
ngOnInit(): void {
this.data = data;
}
tooltip(args: QueryCellInfoEventArgs){
// you can also add tooltip based on condition here
let tooltip: Tooltip = new Tooltip({
content: args.data[args.column.field].toString();
}, args.cell);
}
} |
Hi Shamil,Greetings from Syncfusion.Query : My requirement is to add Tooltip for that particular cell. How we can archive that?You can achieve your requirement by using the “queryCellInfo” event of Grid component. In that event you can add the custom Tooltip component for the cells based on your required conditions. Please refer to the below code example and documentation link for more information.
@Component({selector: 'app-container',template: `<ejs-grid #grid [dataSource]='data' [height]='315' (queryCellInfo)='tooltip($event)' ><e-columns><e-column field='OrderID' headerText='Order ID' textAlign='Right' width=90></e-column><e-column field='CustomerID' headerText='Customer ID' width=120></e-column><e-column field='Freight' headerText='Freight' textAlign='Right' format='C2' width=90></e-column><e-column field='ShipName' headerText='Ship Name' width=120></e-column></e-columns></ejs-grid>`})export class AppComponent implements OnInit {public data: Object[];ngOnInit(): void {this.data = data;}tooltip(args: QueryCellInfoEventArgs){// you can also add tooltip based on condition herelet tooltip: Tooltip = new Tooltip({content: args.data[args.column.field].toString();}, args.cell);}}Documentation: https://ej2.syncfusion.com/angular/documentation/grid/how-to/custom-tool-tip-for-columns/Regards,Pavithra S.
I wish there was more to the example on how to stylize the tooltip better. Perhaps that was in this link, but the link is broken.
https://ej2.syncfusion.com/angular/documentation/grid/how-to/custom-tool-tip-for-columns/
Hi Michael,
Greetings from Syncfusion support,
Based on your query custom tooltip documentation link was not opened. Please refer the below link for custom tooltip for columns,
Custom-tooltip: https://ej2.syncfusion.com/angular/documentation/grid/cell#display-custom-tooltip-for-columns
Please get back us if you need further assistance.
Regards,
Vikram S