- This topic has 1 reply, 2 voices, and was last updated 5 years, 5 months ago by
Support. This post has been viewed 1064 times
-
AuthorPosts
-
February 4, 2021 at 6:23 am #10035974
Naresh Designs
ParticipantHi Team,
Can you please help for Table Tools need to add on Editable Tables?
here is the link – https://www.okler.net/previews/porto-admin/3.1.0/tables-editable.html
I need to Print and PDF buttonsThanks
Naresh
February 4, 2021 at 6:38 am #10035976Support
KeymasterHello Naresh, thanks for your purchase.
Using as base the
tables-editable.htmlpage, please follow the steps below:1) First add the scripts below next to datatables script on footer of page:
<script src="vendor/datatables/extras/TableTools/Buttons-1.4.2/js/dataTables.buttons.min.js"></script> <script src="vendor/datatables/extras/TableTools/Buttons-1.4.2/js/buttons.bootstrap4.min.js"></script> <script src="vendor/datatables/extras/TableTools/Buttons-1.4.2/js/buttons.html5.min.js"></script> <script src="vendor/datatables/extras/TableTools/Buttons-1.4.2/js/buttons.print.min.js"></script> <script src="vendor/datatables/extras/TableTools/JSZip-2.5.0/jszip.min.js"></script> <script src="vendor/datatables/extras/TableTools/pdfmake-0.1.32/pdfmake.min.js"></script> <script src="vendor/datatables/extras/TableTools/pdfmake-0.1.32/vfs_fonts.js"></script>
2) Change the
build: function() {code atjs/examples/examples.datatables.editable.jsto:build: function() { this.datatable = this.$table.DataTable({ dom: '<"row"<"col-lg-6"l><"col-lg-6"f>><"table-responsive"t>p', aoColumns: [ null, null, null, { "bSortable": false } ], buttons: [ { extend: 'print', text: 'Print' }, { extend: 'pdf', text: 'PDF', customize : function(doc){ var colCount = new Array(); $('#datatable-editable').find('tbody tr:first-child td').each(function(){ if($(this).attr('colspan')){ for(var i=1;i<=$(this).attr('colspan');$i++){ colCount.push('*'); } }else{ colCount.push('*'); } }); doc.content[1].table.widths = colCount; } } ] }); $('<div />').addClass('dt-buttons mb-2 pb-1 text-right').prependTo('#datatable-editable_wrapper'); $('#datatable-editable').DataTable().buttons().container().prependTo( '#datatable-editable_wrapper .dt-buttons' ); $('#datatable-editable_wrapper').find('.btn-secondary').removeClass('btn-secondary').addClass('btn-default'); window.dt = this.datatable; return this; },Please try that and let us know if you need further assistance.
Kind Regards,
Rodrigo.
If you are satisfied with Porto Admin and our support, please leave your comment and rating on ThemeForest downloads page. That helps us a lot: https://themeforest.net/downloads
-
AuthorPosts
This topic is marked as "RESOLVED" and can not rceive new replies.