Any solution on wrapped text in column with row selections?

Hi,

I have the similar use case that many seem to have posted – needing to be able to display a dataframe with text wrapped and then being able to select rows (similar to the way it is done with data_editor and the checkboxes). The text wrapping is critical for my case.

Does anyone have a solution for this? It seems like the only way to get the wrapping is via st.table, but I have not been able to find a way to retrieve the results of which rows were clicked. Has anyone implemented that via JavaScript?

Thanks so much for any help and sorry for the repeat! Please let me know if this is tracked somewhere.

Nikesh

Hi,

So I couldn’t find any good solution to this and thought instead of creating a custom component maybe I could do it using a checkbox and a table, and then got to the point of using a checkbox, the cookie manager, and st.column.

Basic idea is that you use a variable to contain the indexes of the rows being selected, and the index is passed by the checkbox component to a function that updates the list of indexes checked. Then you can use this lookup into the dataframe!

The columns functionality seems to allow for word wrapping, the way that the HTML table does (I think you could use that, too). And maybe the st.container if you really want it to look like a table.

I think this probably does require some clearing of the caches.

Not sure if helpful to anyone because such an obscure use case not needing it in an actual table but figured I’d share!

Here’s a snippet illustrating how it might work:

1 Like

Got a little further into this and can and should def be done with st.session_state instead of cookies just noting that