Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

epic: Support interactivity for HTML output #370

Open
2 tasks done
kszlim opened this issue May 31, 2024 · 9 comments
Open
2 tasks done

epic: Support interactivity for HTML output #370

kszlim opened this issue May 31, 2024 · 9 comments
Assignees
Labels
.epic Big features and initiatives Type: ★ Enhancement

Comments

@kszlim
Copy link

kszlim commented May 31, 2024

Prework

Proposal

Support interactivity for html output of great tables. This might be a big ask, I don't know how technically involved it would be, but it would be great to allow basic interactivity like sorting by column, filtering.

I think you'd then want to support a new param in as_raw_html with interactive=True which would then enable these features. Or perhaps it could be a bunch of method calls on table to enable piecemeal interactivity.

This would be a killer feature personally.

Some inspiration could be the level of interactivity of https://docs.datapane.com/blocks/display-blocks/#tables-and-data

@ctdunc
Copy link

ctdunc commented May 31, 2024

I have also been meditating on the fact that this would be an incredible feature. Assuming this is running on a webserver, the interactivity would be at least somewhat tied to the framework that a user chooses (e.g. Flask or Django).

One interesting possibility I've daydreamed about is to provide htmx attributes to different table components that correspond to actions to be performed on the dataframe. This way, great-tables has to incorporate very little (if any) JS and can instead rerender the parts of the table updated by the change using the already existing layout framework.

I would be interested in helping to make this a reality :)

@kszlim
Copy link
Author

kszlim commented May 31, 2024

I think this should theoretically be doable without a webserver, in fact, I think I wouldn't want this feature if it required a webserver.

It should be all doable clientside. Even supporting SQL theoretically can be done clientside (though I think some minimal interactivity is usually all that's needed).

@machow
Copy link
Collaborator

machow commented Jun 5, 2024

Thanks for opening this--we're definitely eager to support something like this! Right now, we're syncing with the shiny team (cc @schloerke) on potentially...

  1. enabling the range of great tables structure and styling on their Data Grid component.
  2. eventually trying to pull out the DataGrid into it's own library, so Great Tables could generate these tables without the need for a web server backend.

AFAIK they're using the tanstack table.

Building on the tanstack table

The R version of Great Tables (gt) uses a wrapper around the tanstack table, called reactable, to generate interactive tables. If we could create a similar wrapper in python, it shouldn't be too hard to wire up Great Tables to it.

Here are some examples of the gt packages interactive tables.

Building on something else

If anyone knows of something better, we're open to it! I know there are a lot of interactive table tools out there that we've probably overlooked!

Potential requirements

  1. Doesn't require a webserver (but could have hooks to optionally wire one up; e.g. shiny, django, fastapi)
  2. Easy to use from things like jupyter lab and VS Code
  3. Clear table building interface Great Tables plugs into

@jrycw
Copy link
Collaborator

jrycw commented Jun 5, 2024

I've seen an example from Panel a few months ago that might be a potential solution for our use case.

@machow
Copy link
Collaborator

machow commented Jun 5, 2024

Oh cool! Here's the panel Tabulator page, which seems to be similar to reactable

@machow machow changed the title Support interactivity for HTML output epic: Support interactivity for HTML output Aug 19, 2024
@machow machow added the .epic Big features and initiatives label Aug 19, 2024
@machow machow self-assigned this Aug 19, 2024
@machow
Copy link
Collaborator

machow commented Aug 19, 2024

We are still wrapping this piece up, but now have a draft of interactive tables using a package called reactable-py

@kszlim
Copy link
Author

kszlim commented Aug 19, 2024

Looks pretty cool, curious if it's possible to make it work with a static html? I think having an interactive table that can work without any backend would be a killer feature.

Even better if you can "sidecar" a parquet file or something that is the source of the data.

@machow
Copy link
Collaborator

machow commented Aug 27, 2024

Oh shoot -- I think it might not be too crazy to remove the pieces that are not self-contained. It looks like some of the javascript pieces are currently downloaded via CDN.

Opened an issue to track on the repo:

@jrycw
Copy link
Collaborator

jrycw commented Oct 17, 2024

I'm considering whether it might be possible to implement the interactivity request using HTMX. The examples provided are impressive, and it seems like you just need to include the JS file in the header to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.epic Big features and initiatives Type: ★ Enhancement
Projects
None yet
Development

No branches or pull requests

4 participants