1

I'm struggling with the issue, where cell text in the datatable in LWC isn't wrapping correctly. It obscures the cell from the next column in some cases. I didn't applied any formatting for that table beside the column size.

enter image description here

The table is declared in js file:

const columns2 = [
     {
         label: 'Name',
         fieldName: 'Name',
         initialWidth: 120
     },
    {
        label: 'Type',
        fieldName: 'Type',
        initialWidth: 100
    }]

Do you know maybe how to solve it? Why in some cases it's wrapping correctly and in some not? Looks like the issue is when there is really long one word, but not only. On the above screen both test names are single words(without white spaces etc). First long name is wrapped while the second not and I can't find out why :/

I tried that and it's wrapping but in some cases it's going over cell border, like on the screen which I posted. This is the result of wrap action :/ Thanks in advance guys!

1 Answer 1

0

Use wrap=true. like below

const columns2 = [
     {
         label: 'Name',
         fieldName: 'Name',
         initialWidth: 120,wrap:true
     },
    {
        label: 'Type',
        fieldName: 'Type',
        initialWidth: 100,wrap:true
    }]
1
  • I forgot to mention that I tried that and it's wrapping but in some cases it's going over cell border, like on the screen which I posted. This is the result of wrap action :/
    – Tom2341
    Jan 20 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.