itables
itables copied to clipboard
WIP Custom datatables requirements
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 Report
Merging #67 (e3c59d6) into main (6861ed8) will increase coverage by
0.06%. The diff coverage is100.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 dataPowered by Codecov. Last update 2862a8b...e3c59d6. Read the comment docs.
@mwouts hi, could u please describe the issue you met? I'm pretty busy today, I can take a look in next few days
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:

- in addition, I have not been able yet to make the highlight example work in neither context (below in Jupyter book):

Do you think you can help me on these issues? Thanks!
@mwouts Sure, I'll take a look. Could you please open the console in developer tool and share the error log?
Thank you @qqdaiyu55 !
Below are some of the logs
- In the version of
datatables_plugin.mdrendered 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$:
- In Jupyter notebook (skipping the button example), the table does not load and I see these errors:

- 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:

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?
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.

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...
Superseded by #235