[SalesForce] How to add a title on hover of a text data cell in an LWC datatable

It seems that the LWC datatable does not just provide title attributes for cell values. I have a cell that will usually have information that is truncated. Currently a user can only see everything in it by doing the wrap text option for the column, but I want them to be able to just hover over the text and see the information without having to click wrap text every time.

Surely, surely Salesforce has some way to add a title to simple text data cells? I have not been able to find any actual documentation on making that happen, though. Is this possible? Does this require a custom column type?

I attempted cellAttributes by doing:
cellAttributes: {title: {fieldName: 'myFieldName}}
but this still did not apply a title.

Best Answer

In order to customize a datatable cell, you should create your own custom cell. You can find the documentation and an example here: https://developer.salesforce.com/docs/component-library/bundle/lightning-datatable/documentation (Section Creating Custom Data Types)

It's up to you to implement showing the title when hovering the cell.

Related Topic