mwouts / itables

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

WIP Custom datatables requirements #67

Closed mwouts closed 4 months ago

mwouts commented 2 years ago

With this PR I'd like to allow custom requirements for datatables, and let people use extensions like "search highlight" or "buttons".

Closes #50

@qqdaiyu55 I don't think this is working properly at the moment, do you think you could help me fix the implementation and the examples ? Thanks !

codecov-commenter commented 2 years ago

Codecov Report

Merging #67 (e3c59d6) into main (6861ed8) will increase coverage by 0.06%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #67      +/-   ##
==========================================
+ Coverage   96.63%   96.69%   +0.06%     
==========================================
  Files          14       14              
  Lines         327      333       +6     
==========================================
+ Hits          316      322       +6     
  Misses         11       11              
Impacted Files Coverage Δ
itables/javascript.py 96.66% <100.00%> (+0.05%) :arrow_up:
itables/options.py 100.00% <100.00%> (ø)
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 2862a8b...e3c59d6. Read the comment docs.

qqdaiyu55 commented 2 years ago

@mwouts hi, could u please describe the issue you met? I'm pretty busy today, I can take a look in next few days

mwouts commented 2 years ago

Hello @qqdaiyu55 , sorry I come back to you only now.

I've done a bit more of testing, and this is what I find:

Do you think you can help me on these issues? Thanks!

qqdaiyu55 commented 2 years ago

@mwouts Sure, I'll take a look. Could you please open the console in developer tool and share the error log?

mwouts commented 2 years ago

Thank you @qqdaiyu55 !

Below are some of the logs

  1. In the version of datatables_plugin.md rendered with Jupyter Book (sorry this is a bit more complex than the standalone highlight example, because it has the buttons example first), I see errors about $: image
  2. In Jupyter notebook (skipping the button example), the table does not load and I see these errors: image image
  3. In Jupyter Lab (again, skipping the button example), the table is shown but the highlight does not work. I see an error but I don't think it is related: image
qqdaiyu55 commented 2 years ago

Sry for late reply, I'm quite busy these days. I just test it with jupyter lab/notebook, it seems work well. Could you please share the notebook or code snippet which you find the problem?

image
qqdaiyu55 commented 2 years ago

The screenshot you shared, these two errors, one in doctool.js, and the other in sphinx. None of them is related to your itables pkg. image

mwouts commented 2 years ago

Just to mention that there might be some overlap between the work on the offline mode at #74 and this PR.

More specifically, the addScript function from @qqdaiyu55 's comment

function addScript(src) {
                return new Promise((resolve, reject) => {
                    var script = document.createElement('script');
                    script.onload = resolve;
                    script.onerror = reject;
                    script.src = src;
                    document.head.appendChild(script);
                });
            }

might be used to load the datatables and jquery libraries from either the static folder or from a CDN at #74 - or conversely, if we find a more canonical way to load the libraries dynamically in Jupyter Lab then we might not need this addScript function...

mwouts commented 4 months ago

Superseded by #235