Dash_table Header Text Flows outside of the Table Cell

Hi there,

I am trying to style the dashtable. My purpose is to wrap text into multiple lines if the text is too long. The code below manages to do that. However, some text in the header flows beyond its cell text box. Any idea what I need to add to my code?

Did any of the examples in https://dash.plot.ly/datatable/sizing work for you?

Thanks Chris. I just went back and tried all the solutions. So far by setting min_width in style_cell works the best. If the min_width is too small, some header texts are squeezed. If I make it larger, for those header/cells with very short length text, they are taking too much space.

I have tried this code:

. The output is exactly what I am looking for. However, since I have sorting function in my table, the headers are squeezed like this: .

Any better way to do this? Thanks again :slight_smile:

Hi,

Maybe a bit late for you, but helpful for future reference. Just add the following line of code in your data table definition:

style_header= {‘whiteSpace’:‘normal’}

hope it helps.

1 Like

Strangely this whitespace attribute matters a lot more than one would think when it comes to wrapping text on to a new line