cannot read property 'copy' of undefined
Hi. i am trying to use copy, excel features in our application. the reference which i used is
http://l-lin.github.io/angular-datatables/#/withButtons
This is how i declared dt-options $scope.dtOptions = DTOptionsBuilder.newOptions() .withLanguage({ "search": "" }) .withOption('paging', false) .withOption('stateSave', true) .withOption('dom','frtip') .withOption('buttons',[ 'copy', 'print', 'excel']);
the js files that i included are datatables.buttons.js angular-datatables.buttons.min.js buttons.colVis.js buttons.flash.js buttons.html5.js buttons.print.js already i had jquery-datatables.js and angular-datatables.js. am i missing any js file? please help me out
Did you include the module dependencies ?
angular.module('showcase.withButtons', ['datatables', 'datatables.buttons'])
If you did, I do not really see where the problem is.
What is the problem exactly ? The buttons not showing up ? The function not working ? ...
yes i have included datatables.buttons.
var app= angular.module('app', ['datatables', 'datatables.buttons']); $scope.dtOptions = DTOptionsBuilder.newOptions() .withLanguage({ "search": "" }) .withOption('paging', false) .withOption('stateSave', true) .withOption('dom','frtip') .withOption('buttons', ['copy','print','excel']);
in console i am getting cannot read property 'ext' of undefined cannot read property 'Buttons' of undefined cannot read property 'ext' of undefined cannot read property 'ext' of undefined
the buttons are not showing up. could you please tell me the order of js files that i need to include in html page?
Can you try using the following syntax :
DTOptionsBuilder.newOptions()
.withButtons([
'colVis',
'copy',
'print',
'excel'
]);
DTOptionsBuilder.newOptions(...).withButtons is not a function. this is the error i am seeing.
the order of JS files i had in html file are
- buttons.colVis.js
- buttons.flash.js
- buttons.html5.js
- buttons.print.js
- angular-datatables.buttons.min.js
- jquery-dataTables.js
- angular-dataTables.js
please correct me if i am wrong. i am not able to use withButtons property. is it due to old angular-datatables.js version? i am using v0.3.1
Looks like you are missing the following :
<script src="bower_components/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
You should reverse the order of your js files, 6, 7, 5 then 1-4
now i changed the files as per your order i.e.
- jquery-dataTables.js
- angular-dataTables.js
- angular-datatables.buttons.min.js
- dataTables.buttons.js
- buttons.colVis.js
- buttons.flash.js
- buttons.html5.js
- buttons.print.js
even though i am not able to see buttons. but in console i am not seeing any errors
You cannot nee the buttons because there is an option missing when you define the DOM.
Try to replace .withOption('dom','frtip') with .withOption('dom','Bfrtip')
Place 'B' where you want the buttons to appear, check https://datatables.net/reference/option/dom.