machow / reactable-py

https://machow.github.io/reactable-py/
43 stars 2 forks source link

Column class_ argument only sets the dev class for the first row #28

Open dhimmel opened 1 week ago

dhimmel commented 1 week ago

Inspired by the R world cup example with emphasized borders between column groups, I've attempted something similar in reactable py:

theme = reactable.Theme(style={".border-left": {"border-left": "4px solid #0f0f0f"}})
reactable.Reactable(
    pl_penguins,
    columns=[reactable.Column(id="island", class_=["border-left"])],
    theme=theme,
)

image

Am I misunderstanding what class_ does? Or is this a bug?

BTW don't feel obligated to release after every fix, I can install from main, if you'd like to let more fixes accrue per release.

machow commented 4 days ago

Shoot -- I'm not too familiar with the different ways reactable sets classes on column cells, but it looks like if it receives a list, then it assumes the first entry is the class for the first cell, the second entry is the class for the second cell, and so on..

It looks like using a plain string will set it for all:

columns=[reactable.Column(id="island", class_="border-left")]

Most of the release process is automated, so it's pretty quick to push these out 😁 (though I'll probably start stacking PRs up a bit more as time goes on)

dhimmel commented 6 hours ago

Ah cool, the string value works to apply the style to all cells. I think the type signature needs updating:

https://github.com/machow/reactable-py/blob/6fe68de53c840996423b823eb08af4f3905a2171/reactable/models.py#L693