[app.component.html]
<ejs-tooltip #tooltip position='BottomCenter'
target=".e-rowcell">
<ejs-grid [dataSource]='data' allowPaging=true (mouseover)='mouseover($event)'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right'></e-column>
<e-column field='CustomerName' headerText='Customer Name' width='150'></e-column>
<e-column field='OrderDate' headerText='Order Date' width='130' format="yMd" textAlign='Right'></e-column>
<e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right'></e-column>
<e-column field='ShippedDate' headerText='Shipped Date' width='130' format="yMd" textAlign='Right'></e-column>
<e-column field='ShipCountry' headerText='Ship Country' width='150'></e-column>
</e-columns>
</ejs-grid>
</ejs-tooltip>
-----------------------------------------------------------------------
[app.component.ts]
export class AppComponent {
public data: Object[] = [];
@ViewChild("tooltip")
public tooltip: TooltipComponent;
ngOnInit(): void {
this.data = orderDetails;
}
mouseover(args) {
if (args.target.classList.contains('e-rowcell') && args.target.innerText) {
this.tooltip.content = args.target.innerText;
}
}
}
|
[app.component.html]
<ejs-tooltip #tooltip position='BottomCenter'
target=".e-rowcell.customcss">
<ejs-grid [dataSource]='data' allowPaging=true (mouseover)='mouseover($event)'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right'></e-column>
<e-column field='CustomerName' [customAttributes]='customAttri' headerText='Customer Name' width='150'></e-column>
<e-column field='OrderDate' headerText='Order Date' width='130' format="yMd" textAlign='Right'></e-column>
<e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right'></e-column>
<e-column field='ShippedDate' headerText='Shipped Date' width='130' format="yMd" textAlign='Right'></e-column>
<e-column field='ShipCountry' headerText='Ship Country' width='150'></e-column>
</e-columns>
</ejs-grid>
</ejs-tooltip>
-----------------------------------------------------------------------------------------------------------------------
[app.component.ts]
export class AppComponent {
public data: Object[] = [];
@ViewChild("tooltip")
public tooltip: TooltipComponent;
public customAttri: object;
ngOnInit(): void {
this.data = orderDetails;
this.customAttri = { 'class': 'customcss' };
}
mouseover(args) {
if (args.target.classList.contains('customcss') && args.target.innerText) {
this.tooltip.content = args.target.innerText;
}
}
}
|
[app.component.ts]
mouseover(args) {
if (args.target.classList.contains('customcss') && args.target.innerText) {
this.tooltip.content = args.target.parentElement.children[2].innerHTML;
}
}
|
queryCellInfo(args: QueryCellInfoEventArgs) {
// CELL TOOLTIP
if (args.data['arrayOfWeeks']['week' + args.column.index]['commentVacancesRotations']) {
const tooltip: Tooltip = new Tooltip({ content: args.data['arrayOfWeeks']['week' + args.column.index]['commentVacancesRotations'].toString(),
openDelay: 300, position: 'RightCenter', showTipPointer: true, cssClass: 'GridTooltip' }, args.cell);
}
}
mouseover(args) {
if (args.target.classList.contains('e-rowcell') && args.target.innerText) {
this.tooltip.content = args.target.innerText;
let rowInfo = this.grid.getRowInfo(args.target); // get row information
} |