I want to start by saying that I am by no means an expert in JavaScript, so apologies in advance if I am missing something obvious.
Example: I'm trying to create a custom tooltip for column A. Using the data from another cell as the parameter for the output of column A's tooltip.
{title: "title", tooltip: function(cell) {return anotherfunction(cell)}...
When passing 'cell' through as a parameter, it's possible to view the information in the rest of the row console.log(cell._cell) but from what I've discovered, there's no way of accessing the rest of the data.
This is a code pen of the issue that I'm having (i've commented out the console.log(cell._cell.value) in the example, as this will make the table fail to render. So, looking at the browsers console, it's possible to see the data that is returned from console.log(cell._cell).
I've tried to use Tabulators cell.getData(), cell.getRow(), cell.getColumn() etc (and a load of others) but each results in an error.
Codepen https://codepen.io/lukeorriss/pen/yLzMapg
If someone could please point me in the right direction for accessing the data in another row from a tooltip function, this would be great. Thank you all, in advance.
Tabulator use 2 types of definitions for tooltip .
So You have to put a condition for your formatTooltip function
function formatTooltip(cell) {
// Need to open browser console log to view this.
if (cell._cell) {
let { name, email, address } = cell.getData();
return `You are ${name}, your email is ${email} and address is ${address}`;
} else if (cell.type === "ColumnComponent") {
return cell.getField();
}
}
See My Codepen