Search code examples
javascripttabulator

Tabulator: Custom icon for buttonCross?


In a Tabulator 4.9 table, I would to have a trash can icon (font awesome) on each row that deletes that row. I have got the function working with buttonCross, but I would like to have a trash can instead of a red cross. In the documentation I found how to create a custom icon of the tickCross through formatterParams > crossElement and inputting the font awesome icon through html, but that doesn't work for buttonCross. I don't see formatterParams for buttonCross in the documentation. Is this not possible or am I missing something?


Solution

  • you can use formatter:"html" and have data as "<i class='fa fa-trash'></i>" And then of course use the cellClick parameter to do your delete from there. Though be careful, coz someone could click in the cell when they are actually just trying to click on the grab handles to do a column resize ?

    Therefore, I might do a :

    <span onclick="deleteRow()"><i class='fa fa-trash'></i></span>

    instead, just to make sure they're only clicking on the trashcan.