ipydatagrid icon indicating copy to clipboard operation
ipydatagrid copied to clipboard

wrapping text in cells with text_wrap=True not really working.

Open joseberlines opened this issue 2 years ago • 2 comments

Issue wrapping text insice cells

To Reproduce I am following the example about wrapping text in: https://github.com/bloomberg/ipydatagrid/blob/58ec6f031194bf33fb00f89518e16634c02d46cc/examples/Text%20Wrapping%20and%20Eliding.ipynb

I have a DataFrame with text in the cells. I would like to force wrapping the text in the cells.

Despite using wrap = True it woul not work

default_renderer = grid.TextRenderer(
    #background_color=grid.VegaExpr("cell.value <= 0.5 ? 'pink' : 'lawngreen'"),
    text_elide_direction="left",
    text_wrap=True)  # <----------------------------

header_renderer = grid.TextRenderer(text_color="navy",
                                    text_wrap=True,
                                    vertical_alignment="top",
                                    background_color="moccasin",
                                    horizontal_alignment="center")

grid.DataGrid(df,
              base_column_size=90,
              base_column_header_size=35,
              base_row_header_size=80,
              layout={"height": "180px"},
              header_renderer=header_renderer,
              default_renderer=default_renderer,
)

Expected behavior I would expect several lines of code in each cell

Screenshots THIS IS WHAT I GET image

THIS IS WHAT I EXPECTED (after adding editable=True and manipulate manually) image

Environment (please complete the following information): Jupyter Hub

joseberlines avatar Feb 15 '22 14:02 joseberlines

Hello Jose 👋

I think the feature is working, including in your first screenshot, but without adjusting the cell height you will not see the wrapped words. ipydatagrid does not adjust the cell height for you. Here is an example of setting the row size (height in this case) to 40 pixels: base_row_size=40.

Let me know if that makes sense. Thanks!

ibdafna avatar Feb 16 '22 04:02 ibdafna

This is an old opened issue here. As a Suggestion would it be possible to allow for auto ajustment of row high? the same as auto_fit_column, but auto_fit_row which will make rows height higher if there are several lines in it.

joseberlines avatar Mar 03 '22 22:03 joseberlines