Hi, I'm using the Syncfusion Grid control, and wanted a toolltip to show on hover of just 1 of the columns. I found out how to do this from searching your forums and found the below code;
My grid
<ejs-grid #issuesGrid [dataSource]='data' id='IssuesGrid'
[allowSorting]="true" [sortSettings]='sortOptions'
[allowSelection]="false"
[allowPaging]="true"
[pageSettings]="pageSettings"
(queryCellInfo)='customiseCell($event)'
(dataBound)='dataBound($event)'
(headerCellInfo)='headerCellInfo($event)'
[resizeSettings]="resizeSettings">
<e-columns>
<e-column field='epicLink' headerText='Project / Workstream'></e-column>
<e-column field='priority' headerText='Priority' width="40" maxWidth="40" [disableHtmlEncode]="false" textAlign="Center">
<ng-template #template let-data>
<span *ngIf="data.priority === 'Critical - Crashes, loss of data, severe memory leak.' || data.priority === 'High - Major loss of function / Published Task'">
<ejs-tooltip id='tooltip' content='{{ data.priority }}' opensOn='Hover'>
<span class="priority">{{ data.priority }}</span>
</ejs-tooltip>
</span>
</ng-template>
</e-column>
<e-column field='key' headerText='Key' width='80' minWidth='80'></e-column>
<e-column field='summary' headerText='Summary' minWidth='400' ></e-column>
<e-column field='release' headerText='Release' minWidth="140" maxWidth="140" hideAtMedia='(min-width: 801px)'></e-column>
<e-column field='status' headerText='Status'>
<ng-template #template let-data>
<ejs-tooltip id='tooltip' content='{{ data.status }}' opensOn='Hover'>
{{ data.status }}
</ejs-tooltip>
</ng-template>
</e-column>
<e-column field='assignee' headerText='Assignee' hideAtMedia='(min-width: 1281px)'></e-column>
<e-column field='reporter' headerText='Reporter' hideAtMedia='(min-width: 1025px)'></e-column>
<e-column field='daysSinceUpdated' headerText='Days Since Update' textAlign="Right" minWidth="140" maxWidth="140" ></e-column>
</e-columns>
</ejs-grid>
And the typescript
headerCellInfo(args) {
if (args.cell.column.field === 'priority') {
const toolcontent = args.cell.column.headerText;
const tooltip: Tooltip = new Tooltip({
content: toolcontent
});
tooltip.appendTo(args.node);
}
}
This is working as expected on a desktop monitor, but on touch devices whenever I try to sort a column, any column, it shows a tooltip with the sort icon in it. Have I missed something? Is there a better way to do it? I would even be happy if I could add it as a title attribute rather than the tooltip, but tooltip is preferred.
|
this.tooltip = new Tooltip({
position: 'BottomCenter',
content: toolcontent,
opensOn: 'Click'
}); |
Hi, I think you have mistaken my issue. I'm not having an issue with the tooltips not showing on the table header for mobile devices, the issue is that they're ONLY supposed to show for 1 column in my grid, and it is showing on every column's table header, and the content of the Tooltip is displaying the sort icon for the table header, and not what is specified in code.