<!DOCTYPE html>
<html>
  <head>
    <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
    
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs-3.3.7/dt-1.10.20/datatables.min.css"/>
 
<script type="text/javascript" src="https://cdn.datatables.net/v/bs-3.3.7/dt-1.10.20/datatables.min.js"></script>
    
    <meta charset=utf-8 />
    <title>DataTables - JS Bin</title>
  </head>
  <body>
    <div class="container">
      <div id="hide-dt"  style="display:none">
      <table id="mainTable" class="table table-striped center" width="100%">
        <thead>
          <tr>
            <th style="display:none;" >Hidden</th>
            <th>Name</th>
            <th>Position</th>
            <th>Office</th>
            <th>Age</th>
            <th>Start date</th>
            <th>Salary</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td style="display:none;">Hidden</td>
            <td>Tiger Nixon</td>
            <td>System Architect</td>
            <td>Edinburgh</td>
            <td>61</td>
            <td>2011/04/25</td>
            <td>$3,120</td>
          </tr>
          <tr>
            <td style="display:none;">Hidden</td>
            <td>Garrett Winters</td>
            <td>Director</td>
            <td>Edinburgh</td>
            <td>63</td>
            <td>2011/07/25</td>
            <td>$5,300</td>
          </tr>
          <tr>
            <td>Hidden</td>
            <td>Ashton Cox</td>
            <td>Technical Author</td>
            <td>San Francisco</td>
            <td>66</td>
            <td>2009/01/12</td>
            <td>$4,800</td>
          </tr>
          <tr>
            <td style="display:none;">Hidden</td>
            <td>Cedric Kelly</td>
            <td>Javascript Developer</td>
            <td>Edinburgh</td>
            <td>22</td>
            <td>2012/03/29</td>
            <td>$3,600</td>
          </tr>
          <tr>
            <td style="display:none;">Hidden</td>
            <td>Jenna Elliott</td>
            <td>Financial Controller</td>
            <td>Edinburgh</td>
            <td>33</td>
            <td>2008/11/28</td>
            <td>$5,300</td>
          </tr>
          <tr>
            <td style="display:none;">Hidden</td>
            <td>Brielle Williamson</td>
            <td>Integration Specialist</td>
            <td>New York</td>
            <td>61</td>
            <td>2012/12/02</td>
            <td>$4,525</td>
          </tr>
          <tr>
            <td>Hidden</td>
            <td>Herrod Chandler</td>
            <td>Sales Assistant</td>
            <td>San Francisco</td>
            <td>59</td>
            <td>2012/08/06</td>
            <td>$4,080</td>
          </tr>
          <tr>
            <td style="display:none;">Hidden</td>
            <td>Rhona Davidson</td>
            <td>Integration Specialist</td>
            <td>Edinburgh</td>
            <td>55</td>
            <td>2010/10/14</td>
            <td>$6,730</td>
          </tr>
          <tr>
            <td style="display:none;">Hidden</td>
            <td>Colleen Hurst</td>
            <td>Javascript Developer</td>
            <td>San Francisco</td>
            <td>39</td>
            <td>2009/09/15</td>
            <td>$5,000</td>
          </tr>
          <tr>
            <td style="display:none;">Hidden</td>
            <td>Sonya Frost</td>
            <td>Software Engineer</td>
            <td>Edinburgh</td>
            <td>23</td>
            <td>2008/12/13</td>
            <td>$3,600</td>
          </tr>
          <tr>
            <td style="display:none;">Hidden</td>
            <td>Jena Gaines</td>
            <td>System Architect</td>
            <td>London</td>
            <td>30</td>
            <td>2008/12/19</td>
            <td>$5,000</td>
          </tr>
          <tr>
            <td style="display:none;">Hidden</td>
            <td>Quinn Flynn</td>
            <td>Financial Controller</td>
            <td>Edinburgh</td>
            <td>22</td>
            <td>2013/03/03</td>
            <td>$4,200</td>
          </tr>
        </tbody>
      </table>
      </div>
    </div>
  </body>
</html>
 
body {
  font: 90%/1.45em "Helvetica Neue", HelveticaNeue, Verdana, Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;
  color: #333;
  background-color: #fff;
}
 
$(document).ready( function () {
    var table = $('#mainTable').DataTable( {
        scrollX: true,
        processing: true,
        language: {
            "lengthMenu": "Mostra _MENU_ files per pàgina",
            "search": "Filtre: ",
            "zeroRecords": "Sense resultats",
            "info": "Pàgina _PAGE_ de _PAGES_",
            "infoEmpty": "Files no trobades a la cerca",
            "infoFiltered": "(filtrat de _MAX_ files totals)",
            "sProcessing": "<img src='/satuxxi/img/loading_gear.gif' width='48px' height='48px'>",
            "paginate": {
                "next": "<span class='oi oi-chevron-right'></span>",
                "previous": "<span class='oi oi-chevron-left'></span>"
            }
        },
        dom: "<'row'<'col-sm-12 col-md-4'B><'col-sm-12 col-md-6'l><'col-sm-12 col-md-2'f>>" +
            "<'row'<'col-sm-12'tr>>" +
            "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
        buttons: [ 
                {
                    extend: 'copy',
                    exportOptions: {
                        columns: [ ':visible' ],
                        format: {
                            body: function ( data, row, column, node ) {
                                if(node.children.length > 0 && node.children[0].type == "button") {
                                    return "";
                                }
                                
                                return data;
                            }
                        }
                    }
                },
                {
                    extend: 'excel',
                    exportOptions: {
                        columns: [ ':visible' ],
                        format: {
                            body: function ( data, row, column, node ) {
                                if(node.children.length > 0 && node.children[0].type == "button") {
                                    return "";
                                }
                                
                                return data;
                            }
                        }
                    }
                },
                {
                    extend: 'pdf',
                    orientation: 'landscape',
                    exportOptions: {
                        columns: [ ':visible' ],
                        format: {
                            body: function ( data, row, column, node ) {
                                if(node.children.length > 0 && node.children[0].type == "button") {
                                    return "";
                                }
                                
                                return data;
                            }
                        }
                    }
                }],
                fnInitComplete: function () {
                    $('#hide-dt').show();
                  table.fixedHeader.adjust();
                    table.columns.adjust().draw();
                },
        error: function() {
            alert("No se ha podido obtener la información");
        }
    } );
} );
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers