Giter VIP home page Giter VIP logo

Comments (7)

TimShawver avatar TimShawver commented on July 18, 2024 1

This appears to be almost functional already. Here are the steps:

  1. After importing qgrid and running nbinstall at the top of your notebook, add the following line to set some options: qgrid.set_defaults(remote_js=True, show_toolbar=True)
  2. Render a qgrid and notice the Export button above it.
  3. Click Export to generate a version of the grid that can be rendered outside of the jupyter notebook. You'll actually see two grids there at this point, and that's OK.
  4. Click save to save your notebook.
  5. Go to File, Download As, Html to download your notebook as a standalone HTML file.

The only thing that didn't work for me is the filter icons in the column headers of the grid were missing in the resulting HTML file. The grid appeared to be totally functional other than that.

from qgrid.

johnjoo1 avatar johnjoo1 commented on July 18, 2024

I would really like to use qgrid outside of Jupyter notebooks to save dataframes as interactive html tables.

It would be great if you had to first create a qgrid object which has methods show_grid and export.

Currently, it looks like we'd have to create another method that is very similar to save_grid just to have the grid object accessible for the grid.export() call.

from qgrid.

valentas-kurauskas avatar valentas-kurauskas commented on July 18, 2024

I tried above steps in the hope to get this working for reveal slides (jupyter nbconvert presentation.ipynb --to slides --post serve). Unfortunately, it does not give a useful output yet: once I add more than four columns, the table becomes garbled (in the slides, not in the notebook) with all columns of extremely small width. Also the filter icon image is broken in the slides.

from qgrid.

motin avatar motin commented on July 18, 2024

Please re-open this issue until a method that works with latest qgrid works :)

qgrid.set_defaults(remote_js=True, show_toolbar=True) yields TypeError: set_defaults() got an unexpected keyword argument 'remote_js'.

I tried exporting using embed_minimal_html:

import pandas as pd
import qgrid
from ipywidgets.embed import embed_minimal_html
from IPython.display import IFrame

df = pd.read_csv(
  "https://gist.githubusercontent.com/rgbkrk/a7984a8788a73e2afb8fd4b89c8ec6de/raw/db8d1db9f878ed448c3cac3eb3c9c0dc5e80891e/2015.csv"
)
view = qgrid.show_grid(df)
embed_minimal_html('qgrid.html', views=[view], title='QGrid')

While this results in a standalone web-page (can be displayed with IFrame("qgrid.html", width=1000, height=400)), its interactivity is broken. It tries to include non-existing qgrid.js and base/js/dialog.js relative to the current directory.

from qgrid.

motin avatar motin commented on July 18, 2024

Aha, just read #110 (comment) - worth including here as well:

The export button is gone in qgrid 1.0 and it's no longer possible to export a fully functional version of qgrid to static html, because in the new version of qgrid the sorting/filtering logic is done on the server. That being said, you should still be able to export a partially functional version of qgrid where sorting/filtering is broken (and only 200 rows are included) once jupyter-widgets/ipywidgets#1597 is fixed.

I realize that's probably not all that useful to people so another alternative that might be a better option is to use the new "binder" service for rendering live notebooks. I'm using it to host the demo notebook for qgrid and it's been great so far: https://beta.mybinder.org/v2/gh/quantopian/qgrid-notebooks/master?filepath=index.ipynb

I'm going to close this since I no longer plan to provide full support for static html exporting, and I think "binder" will be a suitable alternative for a lot of users.

from qgrid.

naomatheus avatar naomatheus commented on July 18, 2024

Hi @motin
I am running a jupyter notebook and hosting it via binder.
Do you experience your server connection dropping frequently? If so how did you manage this?

Did you have any issues rendering your QgridWidget. If so do you have a suggestion for how you solved this?

After looking at JS console. I see these errors:

Failed to load resource: https://hub.gke.mybinder.org/user/name-of-my-repository-xxb6b9w8/static/qgrid.js?v=20191001215319
the server responded with a status of 404 ()

manager-base.js:273 Could not instantiate widget
(anonymous) @ manager-base.js:273

utils.js:119 Error: Could not create a model.
at utils.js:119
(anonymous) @ utils.js:119

3kernel.js:1008 Couldn't process kernel message Error: Script error for "qgrid"
http://requirejs.org/docs/errors.html#scripterror
at makeError (require.js?v=951f856e81496aaeec2e71a1c2c0d51f:168)
at HTMLScriptElement.onScriptError (require.js?v=951f856e81496aaeec2e71a1c2c0d51f:1735)
(anonymous) @ kernel.js:1008

from qgrid.

naomatheus avatar naomatheus commented on July 18, 2024

will open this issue elsewhere

from qgrid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.