I cant add the print buttom
I cant add the print buttom
srcargentina
Posts: 5Questions: 0Answers: 0
I've already add the search buttom, but I cant add the print buttom.
In addition, I wish to change search for buscar (in spanish)
this is the url: http://munafoautomoviles.com/control/autosBOsinseguridad.php
my code is:
if(<?php echo $totalRows_rsAutos; ?> >0){ $(document).ready(function(){ $('#myTable').dataTable(); }); $('#myTable').DataTable( { retrieve: true, scrollY: 600, paging: false, dom: 'Bfrtip', buttons: [ 'print' ] } ); }thanks
This discussion has been closed.
Replies
You have <script> in the wrong order and duplicates so your page is loading with errors. Load order matters.
Also, in addition to the print script, you need the buttons include.
http://jsbin.com/lacaqeb/edit?html,js,output is my jsbin that has them in a working order in the html section
Thanks!. I put the js in the right order and it works.
I dont understand what you mean by saying : "you need de buttons include", because they are already included:
Anyway, the export buttom doesnt appears. Do I miss another js or code?
I read on the reference manual that I have to add:
{
extend: 'excel',
text: 'Save current page',
exportOptions: {
modifier: {
page: 'current'
}
}
}
But when I did it, anything works properly. Should I add it? where exactly?
http://munafoautomoviles.com/control/autosBOsinseguridad.php
sincerely
That a look at the html panel on this page http://jsbin.com/gabara/edit?html,output
Im sorry but I couldnt follow your example
if(<?php echo $totalRows_rsAutos; ?> >0){ $(document).ready(function(){ $('#myTable').dataTable(); }); $('#myTable').DataTable( { retrieve: true, scrollY: 600, paging: false, dom: 'Bfrtip', buttons: [ 'print','copy', 'excel', 'pdf' ] } ); }Is there anything else that you can add?
my table is made from a sql db, so the data is added automatically.
And the js code is:
I am saying is that you are missing some of the needed CDN.
Copy the datatable related <script> and <link> tags to make sure you have the right CDN.
After that, we can look at your code.
Why do you have $('#myTable').dataTable and $('#myTable').DataTable?
I copied your code, but it doesnt work.
----Why do you have $('#myTable').dataTable and $('#myTable').DataTable?---
I copied from others examples.... i dont know wich one is the right.
There is another thing for you to check.
There are two version of buttons, one intended for older browsers, which uses flash and a version for HTML 5.
If you are using the older version, you will have buttons:['excel']
If you are using the newer version, it will be buttons:['excelHtml5'],
so change your code from 'excel' to 'excelHtml5' and see if that fixes it.
See the top FAQ.
The page currently has a Javascript syntax error which is going to stop any buttons from being shown.
Allan
I changed excel to excelHtml5 and all the buttoms dessapear, so I roll it back.
Allan, where is the error? con the jquery.min.js library? Im taking it from the server.... could it have errors?
I can see the print button now. Looks like the JS error has been resolve - perhaps I caught it while you were doing some work on it.
To get the Excel button you need to include JSZip and the HTML5 export buttons. See the
excelHtml5
button type for more info.Allan