searchpanes when called in module not working
searchpanes when called in module not working
https://jsfiddle.net/tacman1123/r6g3c15a/10/
It's should be the same as https://datatables.net/extensions/searchpanes/examples/customisation/verticalPanes.html
but uses modules instead of local versions.
It's likely something to do with the magic of attaching plugins / extensions to jQuery, which I seem to be confused about.
the error is
_display/:56 Uncaught TypeError: table.searchPanes is not a function
at _display/:56:13
This question has an accepted answers - jump to answer
Answers
Well, the previous reply (now deleted) earned that user a ban... I hate spam!
I get a bunch of loading error from the example including for Bootstrap 5:
Is that what you are seeing as well? The
_display
is part of JSFiddle.It looks like you are loading the UMD files (
.js
) but are using a module (for which DataTables has.mjs
files). e.g.https://cdn.datatables.net/1.13.7/js/jquery.dataTables.min.js
should behttps://cdn.datatables.net/1.13.7/js/jquery.dataTables.min.mjs
.jQuery don't provide their own ESM (yet), but you could use
https://esm.sh/jquery@3.6.3
. You'll need to check the Bootstrap part on jsdelivr - I'm not sure about that with the CORS issue.Allan
Thanks, almost there. I think jsdelivr does return the esm as expected.
https://jsfiddle.net/tacman1123/r6g3c15a/21/
No error messages, but no searchpanes either.
The part to insert it was commented out. Also that method returns a jQuery instance, so you need to use
[0]
to get the element: https://jsfiddle.net/mjnrqx5f/ .Allan