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

Export itables rendering #88

Closed
adrienpacifico opened this issue Aug 4, 2022 · 5 comments · Fixed by #92
Closed

Export itables rendering #88

adrienpacifico opened this issue Aug 4, 2022 · 5 comments · Fixed by #92

Comments

@adrienpacifico
Copy link

Hi,
Is it possible to export itables rendering to an html file?
If so, how?

The main application for me would be to integrate it in Reveal.js presentations.

@mwouts
Copy link
Owner

mwouts commented Aug 8, 2022

Hi Adrien, yes you should be able to export your notebook to an html file (with e.g. jupyter nbconvert --to html), and the interactive table will be preserved.

I have not tested the integration with reveal.js but I'd be curious to know if it does work as well. In case it does not work, would you mind sharing a minimal reveal.js notebook with a simple interactive table?

@adrienpacifico
Copy link
Author

Hi Marc,
Thank you for your answer!
What I would have liked is to export only the table such that I can include it in an iframe or something like it.
Finding the html section from an nbconvert export would be tedious (open the hml file, find the corresponding portion of code in a possibly long file, copy-paste the corresponding code, etc).
What I was seeking was something like df.itable_to_html("my_table.html") (or any other variation), or another way to export just the table.
I am not talking about reaveal.js notebook export but vanilla reveal.js. I do not have a minimal example of an interactive table (here is an example with a plotly graph , if just want to put an itable instead ;-) ).
Ps: I am on holiday, but if you want you can assign me the issue, I will take more time to describe my issue or to solve it when I come back.

@mwouts
Copy link
Owner

mwouts commented Aug 9, 2022

Oh, I see.

Then you're looking for itables.javascript._datatables_repr_. See for instance how the show function calls it:

def show(df=None, **kwargs):
"""Show a dataframe"""
html = _datatables_repr_(df, **kwargs)
display(HTML(html))

@mwouts
Copy link
Owner

mwouts commented Aug 11, 2022

FYI the same question appeared in the context of Python Shiny apps at #86

@mwouts
Copy link
Owner

mwouts commented Aug 14, 2022

In the latest release of itables==1.2.0, this is available with:

from itables import to_html_datatable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants