Can someone pls explain to me how to get the buttons styled correctly?? Thanks

Can someone pls explain to me how to get the buttons styled correctly?? Thanks

room4uroom4u Posts: 1Questions: 1Answers: 0
edited August 2017 in Free community support
<!DOCTYPE html>
<html>
<head>
<h2>Dave's CMS-AB</h2>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs-3.3.7/jq-2.2.4/jszip-3.1.3/pdfmake-0.1.27/dt-1.10.15/b-1.4.0/b-colvis-1.4.0/b-flash-1.4.0/b-html5-1.4.0/b-print-1.4.0/cr-1.3.3/fc-3.2.2/r-2.1.1/sc-1.4.2/se-1.2.2/datatables.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/jqc-1.12.4/jszip-3.1.3/pdfmake-0.1.27/dt-1.10.15/b-1.4.0/b-colvis-1.4.0/b-flash-1.4.0/b-html5-1.4.0/b-print-1.4.0/cr-1.3.3/fc-3.2.2/r-2.1.1/sc-1.4.2/se-1.2.2/datatables.min.css"/>
<title>UD PMs - 2</title>
</head>
<body>
<table id="example" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>         
            </tr>
        </thead>       
            <tr>
                <td>Garrett Winters</td>
                <td>Accountant</td>
                <td>Tokyo</td>
                <td>63</td>
                <td>2011/07/25</td>
                <td>$170,750</td>
            </tr>
         </tbody>
    </table>
<script type = "text/javascript">

    
    $('#example').DataTable( {
        dom: 'Bfrtip',
        buttons: [
            'copy', 'csv', 'excel', 'pdf', 'print'
        ]
    } );
</script>
</body> 
</html>

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    Took me a minute to see it - but the Javascript you are loading is DataTables styled (/v/dt) while the CSS being loaded is Bootstrap styled (/v/bs).

    The two should match - otherwise weird things are going to happen!

    Allan

This discussion has been closed.