Massimo D. N.
Massimo D. N.

Reputation: 316

Bootstrap button for Table Print

i have a bootstrap table in my html page. Following the bootstrap documentation https://bootstrap-table.com/docs/extensions/print/ , i downloaded and inserted extensions folder in my project. I created a print button

<div id="toolbar"> 
   <button type='button' class='btn btn-warning btn-lg'><span class='glyphicon glyphicon-print' aria-hidden='true'></span> Stampa mancanti</button> 
</div> 
<table id="example" class="display nowrap" cellspacing="0" width="100%" data-toolbar="#toolbar">

inserted in my page

<script src="extensions/print/bootstrap-table-print.js"></script>

but when i press the PRINT button nothing happen. All other glyphicon buttons (edit, add, delete, etc) works fine but they work with

if(isset($_POST['edit'])){ ..... }

I would like to do something like this:

<script>
        $(document).ready(function() {
                $('#example').DataTable({
                    responsive: true,
                    "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
                    dom: 'Bfrtip',      
                    buttons: [
                        {
            extend:'print',
             exportOptions:{columns:[0,1,2]} 
            },          
            'excelHtml5',            
            'pdfHtml5'
                    ],
                    "language": {
                    "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Italian.json"
                }
                });
            });

    </script>   

but using Bootstrap glyphicon buttons

Upvotes: 2

Views: 3775

Answers (1)

Par Tha
Par Tha

Reputation: 1531

Try this

Right Way:

<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.15.4/extensions/print/bootstrap-table-print.js"></script>

Wrong Way:

<script src="extensions/print/bootstrap-table-print.js"></script>

Upvotes: 4

Related Questions