DataTables

DataTables Examples

HTML

<link rel="stylesheet" href="//cdn.datatables.net/1.10.0/css/jquery.dataTables.css">
<script src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>
<table id="example">
    <thead>
      <tr>
        <th>date</th>
        <th>ordernumber</th>
        <th>totalsales</th>          
        <th>subtotal</th>          
      </tr>
    </thead>
    <tbody>
    </tbody>
</table>
<button id="buildChart">create chart</button>
<div id="chart"></div>

CSS

table.dataTable tbody th, table.dataTable tbody td {
    -moz-user-select: none;
}

JavaScript

var data = [
    { "date" : "20 Jan - Feb 04", "ordernumber" : 1, "totalsales" : 10340, "subtotal" : 50 },
    { "date" : "20 Feb - Mar 05", "ordernumber" : 100, "totalsales" : 23470, "subtotal" : 150 },
    { "date" : "20 June - Dec 06", "ordernumber" : 111, "totalsales" : 450, "subtotal" : 250 },
    { "date" : "20 Mar - Aug 07", "ordernumber" : 222, "totalsales" : 3030, "subtotal" : 350 }    
];

table = $('#example').DataTable({
    data : data,
    sort : false,
    columns: [
        { "data": "date" },
        { "data": "ordernumber" },
        { "data": "totalsales" },
        { "data": "subtotal" }
    ]    
});