I'm new to Electron and currently playing with the electron-api-demos. I'm trying to use the plug-in Datatables.net (and by my searches, I'm not the first one struggling!), both packages has been installed as dependencies (I can see them in package.json)
I had some difficulties with jQuery but after a few searches, manage to make it work using this line on the page I want it:
<script>window.$ = window.jQuery = require('./node_modules/jquery/dist/jquery')</script>
Then I tried many ways to add the Datatables plugin but always ending up with errors. Currently, it's a line after the one with jQuery, then the custom script:
<script>require('./node_modules/datatables.net/js/jquery.dataTables')</script>
<script>require('./renderer-process/foo/bar')</script>
In the custom script, I'm trying to transform a table in datatable:
$(function () {
$('#datatable-bar').DataTable();
});
I end up with one warning and one error:
jQuery.Deferred exception: $(...).DataTable is not a function TypeError: $(...).DataTable is not a function
Uncaught TypeError: $(...).DataTable is not a function
I checked questions here on Stack Overflow, on the forum of Datatables.net and other websites. Two basics answer are:
- jQuery is loaded after the plug-in (not my case I reckon)
- jQuery is loaded twice (how could I verify that possibility?)
Help and/or any other suggestions are welcomed!