I am trying to use the editor in conjunction with webpack, bootstrap 4 and vue.
Seems to work nicely for the most part but the editor package on npm seems to be having some issues or maybe it is just me.
I have installed the following front end dependencies:
"datatables.net-bs4": "^1.10.19",
"datatables.net-editor-bs4": "^1.6.3",
"datatables.net-select-bs4": "^1.2.7",
In my script, I have the following:
// Import jquery
import $ from 'jquery';
// Make it available globally as it needs to be accessible within the single file components (.vue)
window.$ = $;
// Import datatables and the required plugins, using the bootstrap 4 styling
import 'datatables.net-bs4';
import 'datatables.net-select-bs4';
In my vue component:
<template>
<div class="container-fluid">
<div class="row">
<div class="col-12">
<table id="example" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
</tr>
<tr>
<td>Garrett Winters</td>
<td>Accountant</td>
</tr>
</tbody>
</table>
</div><!-- col-12 -->
</div><!-- row -->
</div><!-- container -->
</template>
<script>
export default {
mounted() {
$('#example').DataTable({
select: true,
});
}
}
</script>
<style lang="scss">
@import '~datatables.net-bs4/css/dataTables.bootstrap4.css';
@import '~datatables.net-select-bs4/css/select.bootstrap4.css';
</style>
This works, however, if I try to include the javascript for the editor:
// Import datatables and the required plugins, using the bootstrap 4 styling
import 'datatables.net-bs4';
import 'datatables.net-editor-bs4'
import 'datatables.net-select-bs4';
I get the following error when compiling:
ERROR in ./~/datatables.net-editor-bs4/js/editor.bootstrap4.js
Module not found: Error: Can't resolve 'datatables.net-bs' in '/removed/app/path/node_modules/datatables.net-editor-bs4/js'
@ ./~/datatables.net-editor-bs4/js/editor.bootstrap4.js 8:2-12:4
@ ./assets/js/projects.js
ERROR in ./~/datatables.net-editor-bs4/js/editor.bootstrap4.js
Module not found: Error: Can't resolve 'datatables.net-editor' in '/removed/app/path/node_modules/datatables.net-editor-bs4/js'
@ ./~/datatables.net-editor-bs4/js/editor.bootstrap4.js 8:2-12:4
@ ./assets/js/projects.js
Seems that datatables.net-editor-bs4 requires datatables.net-editor and datatables.net-bs?
Going back to the previous times that I have worked with the editor, I have:
<script src="/assets/plugins/datatables/Editor-1.7.3/js/dataTables.editor.min.js" type="text/javascript"></script>
<script src="/assets/plugins/datatables/Editor-1.7.3/js/editor.bootstrap.min.js" type="text/javascript"></script>
Which made me think okay, maybe I need to install the dependency datatables.net-editor which I did and it left me with one error relating to datatables.net-bs which doesnt really make sense to me because it's for the bootstrap3 framework. Installing it does not solve the issue, just makes some more issues so I am not sure that this is the right path to take.
I am wondering if I have missed a step here?
Has anyone else gotten the editor working with webpack and the npm install?