<!DOCTYPE html>
<html>
    <head>
        <link href="//datatables.net/download/build/nightly/jquery.dataTables.css" rel="stylesheet" type="text/css" />
  
        <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
        <script src="//datatables.net/download/build/nightly/jquery.dataTables.js"></script>
      <link href="//cdn.datatables.net/colreorder/1.1.0/css/dataTables.colReorder.css" rel="stylesheet" type="text/css" />
<script src="//cdn.datatables.net/colreorder/1.1.0/js/dataTables.colReorder.js"></script>
<link href="//datatables.net/download/build/dataTables.colVis.nightly.css?_=4c7fa7e11152715969bcdc821ce0fec1.css" rel="stylesheet" type="text/css" />
<script src="//datatables.net/download/build/dataTables.colVis.nightly.js?_=4c7fa7e11152715969bcdc821ce0fec1"></script>
        <meta charset=utf-8 />
        <title>DataTables - JS Bin</title>
    </head>
    <body>
        <div class="container">
            <table id="example" class="display" width="100%">
                <thead>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Extn.</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </thead>
 
        <tfoot>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Extn.</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;
}
 
$(document).ready( function () {
  
  var table = $('#example').DataTable({
    
    "ajax": '/examples/ajax/data/arrays.txt',
    
    "dom": 'C<"clear">lfrtip',  
    
    "createdRow": function( row, data, dataIndex ) {
      if ( data[3] >5000 ) {
        $('td', row).eq(3).css({'color':'red'});
      }
    }
  });
  
  $(document).on('click', '#example tbody tr',function(){
         table.ajax.reload();       
  });
  
} );
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers