ipyregulartable
ipyregulartable copied to clipboard
More extensive documentation request and some user questions.
This seems an amazing library, but nowhere is clearly explained exactly how you are supposed to update the data in the table, how to access the underlying data structures, and much more. As an example, I'm trying to display the table inside an ipywidget box, and I don't know if it's possible and which function should I use. A practical example of how to construct DataModel class would be very useful too.
Lastly I am using get_state() and setData() to get the data from the table w and to change em, is there any easier way to get the data from the table if using pandas DataFrames like for example a w.to_dataframe() method?
EDIT: I see that using w.datamodel._data i can access the underlying dataframe, but if I change it the table widget doesn't update,is there a way to the refresh the view programmatically?
Best bet is to start with the examples: https://github.com/jpmorganchase/ipyregulartable/tree/main/docs/examples
There is a relatively simple example of a data models here: https://github.com/jpmorganchase/ipyregulartable/blob/main/ipyregulartable/datamodel/demo.py
The best way to force an update on the frontend is by calling draw
on the widget (should happen automatically if the data model changes):
https://github.com/jpmorganchase/ipyregulartable/blob/main/ipyregulartable/widget.py#L110
I haven't written much documentation as the codebase is still pretty alpha, I have a major overhaul in progress in https://github.com/jpmorganchase/ipyregulartable/pull/59 to add some nice defaults like striping, cursor navigation of cells, column/row/both selection, sortable headers, etc. Once that overhaul is done I think the codebase will be in a much better and more stable place and then can have some more extensive docs written.
Thanks for the reply and amazing work! Is ipyregulartable compatible with ipywidgets boxes or will it be in the future? I tried to capture it with a box and with an Output widget but had no luck.