I was following this example and found out that the table takes quite some time to render the tooltip. It doesn't seem to have any delay whatsoever, and I have tried both defaultBrowserTooltip as well as the custom one but both of them are slow. Any given tips on this?
P/S: I'm using React
Some way that I have tried:
tooltipField: 'myTooltipField'
tooltip: (value: string): string => value
Default Browser Tooltip If you don't want to use the grid's tooltip component, you can use the enableBrowserTooltips config to use the browser's default tooltip. The grid will simply set an element's title attribute to display the tooltip.
When we want to display a header tooltip, we set the headerTooltip config as a string , and that string will be displayed as the tooltip. However, when working with custom tooltips we set colDef. tooltipComponent to assign the column's tooltip component and the headerTooltip value will passed to the params object.
Example: Using Browser Tooltips 'use strict'; import React, { useCallback, useMemo, useRef, useState } from 'react'; import { render } from 'react-dom'; import { AgGridReact } from 'ag-grid-react'; import 'ag-grid-community/dist/styles/ag-grid. css'; import 'ag-grid-community/dist/styles/ag-theme-alpine.
As of Ag-grid 23.0.0, this is configurable by the tooltipShowDelay
configuration option.
const gridOptions = {
tooltipShowDelay: 0; // milliseconds, default value 2000ms
};
For earlier versions, Ag-grid used an internal service called TooltipManager
which was not configurable.
The default delay was 2 seconds:
private readonly MOUSEOVER_SHOW_TOOLTIP_TIMEOUT = 2000;
For these earlier versions, you could manually get the service reference from the bean bag and override it, but for versions 23.0.0 and up this is not necessary.
private onGridReady(params: GridReadyEvent) {
// NB! This is unsupported and may break at any time
try {
(params.api as any).context.beanWrappers.tooltipManager.beanInstance.MOUSEOVER_SHOW_TOOLTIP_TIMEOUT = 0;
} catch (e) {
console.error(e);
}
}
This is directly "borrowed" from user demostheneslld who commented on the ag-grid GitHub feature request, but you can set enableBrowserTooltips: true
on the grid options object and then the tooltips will be displayed natively by the browser, rather than formatted by ag-grid. The tooltips then appear almost instantly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With