itables icon indicating copy to clipboard operation
itables copied to clipboard

WIP Custom datatables requirements

Open mwouts opened this issue 3 years ago • 8 comments

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 !

mwouts avatar Mar 29 '22 15:03 mwouts

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.

codecov-commenter avatar Mar 29 '22 15:03 codecov-commenter

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

qqdaiyu55 avatar Mar 30 '22 15:03 qqdaiyu55

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

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

  • this PR works well in Jupyter Book (i.e. when require is available)
  • but in Jupyter Lab, some tables remain loading for ever, like in this screenshot: image
  • in addition, I have not been able yet to make the highlight example work in neither context (below in Jupyter book): image

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

mwouts avatar Apr 13 '22 10:04 mwouts

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

qqdaiyu55 avatar Apr 14 '22 02:04 qqdaiyu55

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

mwouts avatar Apr 14 '22 10:04 mwouts

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 avatar Apr 22 '22 12:04 qqdaiyu55

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

qqdaiyu55 avatar Apr 22 '22 12:04 qqdaiyu55

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 avatar May 09 '22 17:05 mwouts

Superseded by #235

mwouts avatar Mar 05 '24 21:03 mwouts