DataTables

DataTables Examples

HTML

<link rel="stylesheet" href="//cdn.datatables.net/1.10.0/css/jquery.dataTables.css">
<script src="https://cdn.datatables.net/1.10.9/js/jquery.dataTables.js"></script>
<table id="example">
        <thead>
            <tr>
                <th>Seq.</th>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </thead>
 
        <tfoot>
            <tr>
                <th>Seq.</th>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </tfoot>
 
        <tbody>
            <tr>
                <td>2</td>
                <td>Tiger Nixon</td>
                <td>System Architect</td>
                <td>Edinburgh</td>
                <td>2011/04/25</td>
                <td>$320,800</td>
            </tr>
            
        </tbody>
    </table>

JavaScript

$(function()
{
    var dataTable = $('#example').DataTable(
    {
        initComplete: function ()
        {
            console.log('test2');
            $('#example').trigger('myEvent');
    	}
    });
    
  dataTable.row.add($('<tr> <td>nom</td> <td>email</<td> <td>téléphone</td> <td>sfd</td> <td>sdf</td> <td>sdfsdf</td> </tr>'));
         dataTable.draw();
    
    console.log(dataTable.data());
});