mwouts / itables

Pandas DataFrames as Interactive DataTables
https://mwouts.github.io/itables/
MIT License
757 stars 56 forks source link

Fix itables in Jupyter Lab #33

Closed mwouts closed 2 years ago

mwouts commented 2 years ago

Fixes #3

@fcollonval, is this a correct port of your suggested fix?

At least that seems to work! I have tested it with

pip install git+https://github.com/mwouts/itables.git@fix_itables_in_jlab

and the result is this: image

codecov-commenter commented 2 years ago

Codecov Report

Merging #33 (1c81508) into master (ab39dae) will increase coverage by 0.02%. The diff coverage is 100.00%.

:exclamation: Current head 1c81508 differs from pull request most recent head 80ada6b. Consider uploading reports for the commit 80ada6b to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##           master      #33      +/-   ##
==========================================
+ Coverage   97.79%   97.82%   +0.02%     
==========================================
  Files          10       10              
  Lines         227      230       +3     
==========================================
+ Hits          222      225       +3     
  Misses          5        5              
Impacted Files Coverage Δ
itables/javascript.py 95.78% <100.00%> (+0.13%) :arrow_up:
itables/version.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ab39dae...80ada6b. Read the comment docs.

mwouts commented 2 years ago

Is this possible that this works with Jupyter Lab 2.2.9 but not Jupyter Lab 3 or 4? I can't get this to work on Binder: image

mwouts commented 2 years ago

Oh I think I see the problem... I can't use require.config to load require... But then I have no idea then on how to load require :laughing:

fcollonval commented 2 years ago

I would say that you can still use the trick of displaying HTML script tag to load require. But you will need to wait for it to be available before loading the Javascript using it. But a better (and more secure way) would be to use an iframe like in that example for d3.

mwouts commented 2 years ago

But a better (and more secure way) would be to use an iframe like in that example for d3.

Thanks @fcollonval. Yes that is an interesting suggestion! For now I think I'm just going to include the code snippet in the documentation, and next year I'll try the suggested approach.