JSFiddle - React, Tailwind, and code Playground

by MarkBennett

HTML

<script type="text/javascript" src="http://datatables.net/download/build/jquery.dataTables.js"></script>

    <table>
    <thead>
        <th>foo</th>
    </thead>
    <tr>
        <td>test</td>
    </tr>
</table>

JavaScript

$(function() {
    // Init the datatable
    $('table').dataTable();
    
    // Retrieve a reference to the existing DataTable and it's settings
    var table = $('table').dataTable({"bRetrieve":true}),
        settings = table.fnSettings();
    
    
    // Add a callback
    settings.aoDrawCallback.push({
        "fn": function() {
            alert("You would update the sort here");
        },
        "sName": "updateSort"
    });
    table.fnDraw(true);
    
    // Check this all out in the debugger by uncommenting the following line
    // debugger
});