qgrid icon indicating copy to clipboard operation
qgrid copied to clipboard

Wrapping text in a grid cell

Open nd7141 opened this issue 7 years ago • 12 comments

Environment

Windows, Jupyter, Qgrid 1.1.1

Description of Issue

I have a dataframe with text. I would like to see my text wrapped in a cell (and ideally, the height of the cell adjusted automatically). Is there a way to do this in Qgrid? Because I can do it easily using pure pandas.

Reproduction Steps

Create dataframe

row = dict(title= 'CoT: Cooperative Training for Generative Modeling of Discrete Data',
tldr= 'We proposed Cooperative Training, a novel training algorithm for generative modeling of discrete data. We introduce stochastic state transition mechanism to RNNs, simplifies finite state automata (DFA) extraction, forces RNNs to operate more like automata with external memory, better extrapolation behavior and interpretability.')
df = pd.DataFrame([row])

Show wrapped text in pure pandas.

pd.set_option('display.max_colwidth', -1)
df

No wrapped text in Qgrid

qgrid.show_grid(df)

What steps have you taken to resolve this already?

I tried to use options from SlickGrid, but no help.

Anything else?

Any workaround will help.

nd7141 avatar Nov 15 '18 12:11 nd7141

I'd consider that very useful as well.

Only workaround I've come up with so far is inserting a line break (<br>) after every k-th word and increasing the row height. This is is rather unsatisfactory though, since it is inconvenient to have every row with the same height if the contained text differs in length.

rmitsch avatar Feb 27 '19 11:02 rmitsch

Is there any update on when wrapping text in a cell can be implemented?

SupriyaKapur avatar Aug 06 '19 01:08 SupriyaKapur

I'd consider this feature very useful as well.

adminflexprn avatar Sep 23 '19 16:09 adminflexprn

I am also non stop looking for a pandas plotting solution enabling wrapping text

joseberlines avatar Feb 18 '20 17:02 joseberlines

Any update for this?

fuzihaofzh avatar Jun 18 '20 10:06 fuzihaofzh

Any update for this?

angusfong avatar Sep 28 '21 09:09 angusfong

Wrapping is possible since last version @angusfong

joseberlines avatar Oct 10 '21 19:10 joseberlines

@joseberlines that's great news; would you mind sharing a reference to the method?

angusfong avatar Oct 11 '21 05:10 angusfong

@angusfong Hei I am sorry. I made a mistake. I thought I was talking about other library where this was recently implemented.

joseberlines avatar Oct 11 '21 09:10 joseberlines

@joseberlines haha all good. What is this other library? The most important thing for me is an interactive table that (1) supports sorting and filtering; (2) integrates with Jupyter.

angusfong avatar Oct 11 '21 09:10 angusfong

Ipydatagrid

joseberlines avatar Oct 11 '21 09:10 joseberlines

I follow both repositories. I saw "grid" and my head drifted towards ipydatagrid.

joseberlines avatar Oct 11 '21 09:10 joseberlines