- Home
- Forum
- Angular - EJ 2
- How to add Tooltip for a Gird cell?
How to add Tooltip for a Gird cell?
Hi all,
I'm using 'ejs-grid' and columns created by using "columns" property.
field: 'chart', headerText: 'Chart', textAlign: 'Center', width: '35'
, template: this.gridChartTemplate
this.myGrid.Columns = this.myFields; // 'myFields' is an array which included column settings.
<ng-template let-column #gridChartTemplate let-data>
<img src="assets/graphicon.PNG" class="chart-link-icon" (click)="gridChartClicked(data)">
</ng-template>
My requirement is to add Tooltip for that particular cell. How we can archive that?
Thank you.
SIGN IN To post a reply.
7 Replies
PS
Pavithra Subramaniyam
Syncfusion Team
February 26, 2019 04:43 AM UTC
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 here
let 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.
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.
Hi Pavithra,
I followed your solution and changes done in my code as it is. But I'm getting code error, (Screenshots are attached)
import { FilterSettingsModel, IFilter, Grid, Resize, ContextMenuItemModel, ContextMenuService, ToolbarItems, EditSettingsModel, SaveEventArgs, DialogEditEventArgs, BeginEditArgs, BeforeBatchAddArgs, BeforeBatchSaveArgs, GridComponent, BatchCancelArgs } from '@syncfusion/ej2-ng-grids';
import { QueryCellInfoEventArgs } from '@syncfusion/ej2-angular-grids';
import { Tooltip } from '@syncfusion/ej2-popups';
My imports like above.
Attachment: Screenshots_85c201ce.zip
NE
Neo
February 26, 2019 05:34 AM UTC
NE
Neo
February 26, 2019 06:29 AM UTC
Problem solved. Some changes done in "tooltip" event.
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 as HTMLElement);
}
Thank you very much Syncfusion team.
PS
Pavithra Subramaniyam
Syncfusion Team
February 26, 2019 07:38 AM UTC
Hi Shamil,
Thanks for your update.
We are happy that your requirement has been achieved.
Please contact us if you need any further assistance on this.
Regards,
Pavithra S.
MS
Michael Sage
November 13, 2023 03:17 PM UTC
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/
VS
Vikram Sundararajan
Syncfusion Team
November 14, 2023 08:39 AM UTC
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
SIGN IN To post a reply.
- 7 Replies
- 4 Participants
-
NE Neo
- Feb 25, 2019 12:22 PM UTC
- Nov 14, 2023 08:39 AM UTC