How do I include other Datatable extentions with Requirejs?

How do I include other Datatable extentions with Requirejs?

codedcontainercodedcontainer Posts: 1Questions: 1Answers: 0

I have included the datatables.net plugin using the "datatables.net" id in my required configuration settings. This loads correctly, however, when trying to add another plugin such as the responsive plugin, I am not sure what the exact ID should be for this or if I need to create a shim. I presume that I don't need to add these files because they have already been defined using the define() keyword. I have also tried to add all the extensions however I get other errors which would suggest that the order of the concatenated files is incorrect. How can I include other extensions using requirejs? The below js file (pickup search) does not result in any of my tables being responsive.

Configuration file:

require.config({
baseUrl: '/vendors/',
paths: {
jquery : "http://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min",
'custom': "/vendors/custom",
"pickupSearch-js": "/build/js/pickupSearch-js",
//angular: "https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular",
//'angularMain': '/build/js/angularMain',
'iCheck': "iCheck/icheck.min",
'datatables.net': "datatables/js/jquery.dataTables",
'datatables.net-bs': "datatables.net-bs/js/datatables.net-bs",
'buttons': "datatables.net-buttons/js/dataTables.buttons",
'buttons-bootstrap': "datatables.net-buttons/js/buttons.bootstrap",
'datatables_responsive': 'datatables.net-responsive-bs/js/dataTables.responsive',
'fancybox': "https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox",
'bootstrap': "bootstrap/dist/js/bootstrap.min",
fastclick: "fastclick/lib/fastclick",
vfs_fonts: "pdfmake/build/vfs_fonts",
ngprogress: "nprogress/nprogress"
},
shim: {
'pickupSearch-js':{
deps: [ 'datatables.net', 'fancybox', 'custom', 'iCheck'],
exports: 'shop-js'
},
'fancybox': {
deps: ['jquery'],
exports: 'fancybox'
},
'bootstrap': {
deps:['jquery'],
exports: 'bootstrap'
},
'iCheck': {
deps: ['jquery', 'datatables.net'],
exports: 'iCheck'
},
'custom': {
deps: ['jquery', 'datatables.net', 'bootstrap'],
exports: 'custom'
}
}
});

require(['pickupSearch-js'], function(){

});

pickupSearch-jsj.js:

$("#datatable-buttons").DataTable({
paginate: true,
dom: "Bfrtip",
buttons: [{
extend: "copy",
className: "btn-sm"
}, {
extend: "csv",
className: "btn-sm"
}, {
extend: "excel",
className: "btn-sm"
}, {
extend: "pdfHtml5",
className: "btn-sm"
}, {
extend: "print",
className: "btn-sm"
}, ],
responsive: true,
..............

This discussion has been closed.