Tabulator v5 tooltip: cell.getData is not a function?

Viewed 308

Using Tabulator v5 with Laravel (v8).

In the tooltip of a column I want to refer to another property.

This used to work in v4:

resources/js/app.js

import {TabulatorFull as Tabulator} from 'tabulator-tables';
window.Tabulator = Tabulator;

table.blade.php

var table = new Tabulator("#table", {
...
  columns: [
    { title:'test', field:'test',
      tooltip: function(cell) {
        console.log("cell:", cell ) // ColumnObject (?)
        console.log("field:", cell.getField() ) // "test"
        console.log("cells:", cell.getCells() ) // empty
        console.log("data:", cell.getData() ) // error: no such function
        //return cell.getData().someProperty
      },
    },
  ],
...
})

Now I get an error in the console:

cell: Proxy {_column: Column$1, type: 'ColumnComponent'}
field: test
cells: []
The column component does not have a getData function, have you checked that you have the correct Tabulator module installed?

Tabulator's tooltip documentation states the argument is a CellComponent but it actually is a ColumnComponent? And/but getCells() does not return the cells?

1 Answers

There is no getCells function on a Cell Component, you would need to get the Row Component to call that function.

So your code should read:

console.log("cells:", cell.getRow().getCells())
Related