I am using a lightning-datatable. I have a description field for one of my columns that I would like to better display the text. I would like to either be able to have 3 lines for this field if the data needs it. I tried to use wrapText: true but that just bleeds the text into the next field. I tried looking for a full list of column cellAttributes without success. How can I display the Description field so it shows multiple lines if needed?
const cols = [
{ label: 'Status', fieldName: 'Status__c', sortable: "true", initialWidth: 90},
{ label: 'Number', fieldName: 'Group_Number__c', type: 'text', sortable: "true", initialWidth: 125 },
{ label: 'Eff Date', fieldName: 'Effective_Date__c', type: 'date-local', sortable: "true", initialWidth: 10},
{ label: 'Description', fieldName: 'Description__c', type: 'longtext', sortable: "true", initialWidth: 520, editable: true, wrapText: false},
{label: 'Actions', type: 'action', fixedWidth: 70, fixedHeight: 90,
typeAttributes: {
rowActions: actions,
// menuAlignment: 'right'
}
}
];
Best Answer
You need to set number of visible lines as
data-table
attributewrap-text-max-lines
. Like this.