Hi Team,
How to add the Dynamic tooltip content for the Grid Header ?
For Example, If you do sort a column the Header Tooltip should shows as Ascending, then if you sort it again then it should shows as Descending .
I have tried this, but it sets initially when the grid loads after that Tooltip content is not changing when I do sorting
Thanks
Nambi R
|
public tooltip: Tooltip;
// Grid’s headerCellInfo event handler
headerCellInfo(args) {
if (args.cell.column.field === 'CustomerName') {
this.tooltip = new Tooltip({
beforeOpen: this.beforeOpen.bind(this)
});
this.tooltip.appendTo(args.node);
}
}
// Tooltip’s beforeRender event handler
beforeOpen() {
if (this.grid.sortSettings.columns.length !== 0) {
// Condition is executed if there are sorted columns
this.grid.sortSettings.columns.forEach(col => {
if (col.field === 'CustomerName')
// The column’s sort direction is set as the tooltip content
this.tooltip.content = col.direction;
})
} else {
// If the particular column is not sorted then the default content can be set here
this.tooltip.content = 'default';
}
} |
Hi Sujith,
Thanks. That works for me .
One thing I need to know is How to make the text (i.e., Ascending or Descending) to center in Tooltip ?
In below screenshot the text Descending is aligned to Left, I need it to be center.
Thanks,
Nambi
|
this.tooltip = new Tooltip({
position: 'TopCenter',
beforeOpen: this.beforeOpen.bind(this)
});
this.tooltip.appendTo(args.node); |