cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2: jQuery Datatables Button Extentions Not Working

Magento 2: jQuery Datatables Button Extentions Not Working

I'm new to Magento 2.3, I'm trying to apply jQuery DataTable(DONE), after than, I want to add it's Button Extention, for that i need to add two more js, so i initialize it, but getting error in console, 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:

These files are added in:

/EC/Downloads/view/adminhtml/web/js/buttons_print.js

/EC/Downloads/view/adminhtml/web/js/buttons.js

<script type="text/x-magento-init">
    {
        "*": {
            "EC_Downloads/js/buttons":{},
            "EC_Downloads/js/buttons_print":{}
        }
    }        
</script>

 

Getting this error:

Screenshot from 2019-05-29 14-48-31.png

 

2 REPLIES 2

Re: Magento 2: jQuery Datatables Button Extentions Not Working

Hi @Partab Saif 

 

Not able to see attached error screenshot. Can you please upload this image to third party and share URL here.

 

Thanks

 

---
If you've found one of my answers useful, please give"Kudos" or "Accept as Solution"

Re: Magento 2: jQuery Datatables Button Extentions Not Working

Hey @PankajS_Magento , Please click this link you'll find an image....

 

Click Here For Error Image....