Show records down page with export button on datatables

Cannot display records on page after export buttons are displayed. I want to display them on my desk. Here is my code:

$(document).ready(function() { $('#dataTables-example').DataTable({ pageLength: 5, dom: 'Bfrtip', buttons: ['csv', 'excel', 'pdf', 'print'], responsive: true }); $('.datetext').datepicker({ format: "yyyy-mm-dd" }); }); 

It is displayed on every page if I delete the buttons on the tables, but I want to display both of them. How to display both of them?

+5
source share
4 answers

This layout is done here:

 dom: 'Bfrtip', 

So, you have several options for this, and I don’t know what you want to do, but try the following:

 dom: 'flit', 

A selector will appear on the left. The buttons you add are usually added to the right, so you need to set this to the left.

+7
source

If I'm not mistaken, you want the pagelength and export buttons to be displayed at the same time. Like me, instead of going to the native lunge, you can get a really nice click on the button down with the code below, in addition to your main export buttons. You just need to pass the argument to "pageLength" to initialize the DT with an extra button, which will be the placeholder for the page length. An example will be.

 $(document).ready(function() { $('#example').DataTable( { dom: 'Bfrtip', // Configure the drop down options. lengthMenu: [ [ 10, 25, 50, -1 ], [ '10 rows', '25 rows', '50 rows', 'Show all' ] ], // Add to buttons the pageLength option. buttons: [ 'pageLength','excel','print' ] }); }); 

Remember to include select js and css. Here you can find

+4
source

If you want to display the og drop-down list on the page and the export button in the same table than instead of "lBfrtip".

 $(document).ready(function() { $('#example').DataTable( { dom: 'lBfrtip', buttons: [ 'copyHtml5', 'excelHtml5', 'csvHtml5', 'pdfHtml5' ] } ); } ); 
+1
source

instead of using Bfrtip you can use Blfrtip adding L (small letter) to enable the display of buttons and export records and records / records.

0
source

Source: https://habr.com/ru/post/1238879/


All Articles