+ Start a Discussion
Matyas CsabaMatyas Csaba 

lightning:Datatable default WRAP

Hello Helplers

I  have a question related  to  Lihtning:dataTable  componenent
There is an option  the  CLIP  or WRAP  the test  in a cell.
By  Default CLIP  is used and user  can switch to WRAP

What I  want is  to  have the  WRAP  being defaulted

Is  there any  solution for this?

Thanks in advance
Csbaa 
Best Answer chosen by Matyas Csaba
sfdcMonkey.comsfdcMonkey.com
Hi Csbaa , No, as per official documentation there is no options to change the default drop down action. and hopefully in future update we will able to change the default state of table action, it will be very useful feature.

Kindly let us know if it helps you, and close your query with best answer so it will helps other in future.

All Answers

sfdcMonkey.comsfdcMonkey.com
Hi Csbaa , No, as per official documentation there is no options to change the default drop down action. and hopefully in future update we will able to change the default state of table action, it will be very useful feature.

Kindly let us know if it helps you, and close your query with best answer so it will helps other in future.
This was selected as the best answer
Matyas CsabaMatyas Csaba
Thanks Piyush for the fast reply

official  doc  says  it  is not  possible or there is  no mention in the specs  that it  is possible or not?

can we control this  via code?

Regards
Csaba 
@jeronimoburgers ☁@jeronimoburgers ☁
If you want to modify the behavior for all columns you could op for CSS to override the .slds-truncate class.
It's typically an anti-pattern to use !important, so be vigilent for unexpected results. 
In my own lightning:datatable it works up to expectations.
 
.THIS.results-wrap td .slds-truncate {
    white-space: normal!important;
    overflow-wrap: break-word!important;
    word-wrap: break-word!important;
}

 
manish1 yekhandemanish1 yekhande
Hi, if we use above code then it will wrap the data.but wrap or clip text is not working afterwards.Also it will not select the WRAP TEXT option.
If it is not possible, is there any way to hide the column header action (CLIP and WRAP).Please suggest.its urgent.

Thank you in advance!
Narsimha RaoNarsimha Rao
Hello All,
Struggling with the same problem. If anyone found a good solution, please post. Thanks!

@manish1 yekhande
Try the below code if you want to hide the header actions.
.THIS .tableheader-hidden thead th button { 
     visibility: hidden; 
     display: none; 
}

 
VSK98VSK98
Hi All,

.THIS.slds-button__icon {
    display: none;
}

It will work 

Regards,
VSK98
KCali12KCali12
With the Spring 2020 release, we now have a wrapText attribute you can use to wrap your text in a lightning:datable cell:
var columns = [
{ label: 'Description', fieldName: 'description', type: 'text', wrapText: true },
//other column data
];
https://releasenotes.docs.salesforce.com/en-us/spring20/release-notes/rn_aura_components.htm

I used this new attribute, plus @Narsimha Rao 's recommendation to remove the column header, which worked great.