<!DOCTYPE html>
<html>
    <head>
    <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
    <link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
    
    <link rel="stylesheet" type="text/css" href="https://nightly.datatables.net/searchpanes/css/searchPanes.dataTables.min.css" />
    <link rel="stylesheet" type="text/css" href="https://nightly.datatables.net/select/css/select.dataTables.min.css" />
    
    
    <script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
    
    <script src="https://nightly.datatables.net/searchpanes/js/dataTables.searchPanes.min.js"></script>
    <script src="https://nightly.datatables.net/select/js/dataTables.select.min.js"></script>
    <script src="https://nightly.datatables.net/buttons/js/dataTables.buttons.min.js"></script>
    <script src="https://nightly.datatables.net/buttons/js/buttons.html5.min.js"></script>
    
        <meta charset=utf-8 />
        <title>DataTables - JS Bin</title>
    </head>
    <body>
        <div class="container">
          <button>ajax.reload()</button>
            <table id="example" class="display" 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>
                <tfoot>
                    <tr>
                        <th>Name</th>
                        <th>Position</th>
                        <th>Office</th>
                        <th>Age</th>
                        <th>Start date</th>
                        <th>Salary</th>
                    </tr>
                </tfoot>
            </table>
        </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;
}
div.container {
    min-width: 980px;
    margin: 0 auto;
}
 
// Server-side processing with object sourced data
$(document).ready(function() {
 
  var table = $("#example").DataTable({
                deferRender: true,
                "processing": true,
                "serverSide": false,
                'language': {
                    'loadingRecords': '&nbsp;',
                    'processing': 'Loading...'
                },    
                "order": [[3, "desc"]],
                dom: 'Pfrtip',
                //stateSave: true,
                searchPanes: {
                    viewTotal: true,
                    columns: [1, 2, 3, 4],
                    layout: 'columns-4'
                },
                columnDefs: [
                    {
                        searchPanes: {
                            show: true
                        },
                        targets: [1, 2, 3, 4]
                    }
                ],
                "ajax": "/ssp/objects.php",
                "columns": [
                  { "data": "first_name" },
                  { "data": "last_name" },
                  { "data": "position" },
                  { "data": "office" },
                  { "data": "start_date" },
                  { "data": "salary" }
                ]             
  });
  
  
  
  
  
  $('button').on('click', function() {
    table.ajax.reload(null, false);
  });
  
  
  
  
  
  
            table.on('stateLoaded.dt', function () {
                console.log('stateLoaded event fired.');
            });
            table.on('select.dt', function () {
                console.log('select event fired.');
            });
            table.on('deselect.dt', function () {
                console.log('deselect event fired.');
            });
            table.on('init.dt', function () {
                console.log('init event fired.');
            });
            table.on('xhr.dt', function () {
                console.log('ajax xhr event fired.');
            });
            table.on('processing.dt', function () {
                console.log('processing event fired.');
            });
            table.on('search.dt', function () {
                console.log('search event fired.');
            });
            // On each draw, update the data in the chart
            table.on('draw.dt', function () {
                console.log('draw event fired.');
            });
  
  
  
} );
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers