============================UPDATED 1.1============================
I'm new to Magento 2.3, I'm trying to apply jQuery DataTable(DONE), after than, I want to add it's Button Extension, for that i need to add two more js, i did, now my Js file in included but can't see print button, Here is my code:
/EC/Downloads/view/adminhtml/requirejs-config.js
var config = {
map: {
'*': {
dataTables: 'EC_Downloads/js/datatables.min'
}
}
};
/EC/Downloads/view/adminhtml/templates/test.phtml
<script>
require(['jquery', 'jquery/ui','dataTables'], function($){
$(document).ready(function($){
$('#example').DataTable({
dom: 'Bfrtip',
buttons: [
'print'
]
});
});
});
</script>
Initializing other two js button.js, button_print.js like this:
<script type="text/x-magento-init">
{
"*": {
"EC_Downloads/js/buttons":{},
"EC_Downloads/js/buttons_print":{}
}
}
</script>
Getting This Error: enter image description here
2 Answers 2
I've used dataTables before in frontend theme. Not that different to what you have tried. Just for clarity here's what I ended up with.
require(['jquery', 'jquery.dataTables'], function(,ドル DataTable) {
app/design/frontend/Vendor/Theme/Magento_Theme/requirejs-config.js
{
"jquery.dataTables": "Magento_Theme/js/jquery.dataTables.min"
},
Location of file
app/design/frontend/Vendor/Theme/Magento_Theme/web/js/jquery.dataTables.min.js
Worked for me.
-
Bro @DominicXiegen dataTable is working for me, the problem is i just want to add Button Extention
https://www.datatables.net/extensions/buttons/examples/initialisation/simple.htmlwhich is not working.....Partab Saifuddin Zakir– Partab Saifuddin Zakir2019年05月29日 03:31:57 +00:00Commented May 29, 2019 at 3:31
Try to replace your <script> tag with below code
<script type="text/x-magento-init" />
Refer: https://devdocs.magento.com/guides/v2.3/javascript-dev-guide/javascript/js_init.html
-
could you show me how i use it in my code ???Partab Saifuddin Zakir– Partab Saifuddin Zakir2019年05月29日 06:37:27 +00:00Commented May 29, 2019 at 6:37
-
not working, your code not working in
.phtmlPartab Saifuddin Zakir– Partab Saifuddin Zakir2019年05月29日 09:04:49 +00:00Commented May 29, 2019 at 9:04 -
gettting the same error?Saphal Jha– Saphal Jha2019年05月29日 09:18:38 +00:00Commented May 29, 2019 at 9:18
-
i'm getting a syntax error, my datatable works perfectly just want to add buttons for print :( datatables.net/extensions/buttons/examples/initialisation/…Partab Saifuddin Zakir– Partab Saifuddin Zakir2019年05月29日 09:31:30 +00:00Commented May 29, 2019 at 9:31
-
Please see updated question, i initialize other two JS and getting error in console.... @SaphalJhaPartab Saifuddin Zakir– Partab Saifuddin Zakir2019年05月29日 09:48:20 +00:00Commented May 29, 2019 at 9:48
Explore related questions
See similar questions with these tags.
sudo rm -rf var/ pub/static/adminhtml generated/sudo php bin/magento setup:di:compile,sudo php bin/magento setup:static-content:deploy -f&CleanFlush....