PablocFonseca / streamlit-aggrid

Implementation of Ag-Grid component for Streamlit
https://pypi.org/project/streamlit-aggrid/
MIT License
1.05k stars 199 forks source link

Text wrapping with line breaks on white space #157

Closed dajavous closed 1 year ago

dajavous commented 1 year ago

Thank you for developing this very useful Streamlit application. I would like to use text wrapping in the cell contents for some long text entries, which is easy to setup with:

gb.configure_default_column(wrapText=True, autoHeight=True)

for example in https://dajavous-thebcd-public-app-ztufun.streamlit.app/

but I also need to include code so that the line breaks in the text wrapping does not break in the middle of words, but am unclear how to define white-space: normal; for the cell contents. The blog for Ag-Grid includes some good template details for the header text, but not for the cell contents: https://blog.ag-grid.com/wrapping-column-header-text/

David Armstrong.

dajavous commented 1 year ago

I sorted out how to overwrite the default word-break css with:

gb.configure_default_column(wrapText=True, autoHeight=True, cellStyle={'word-break': 'break-word'})

which now allows me to keep the app window narrow for the text contents involved.