DataTable Numbering

var table = $('#table').DataTable({
	data: data,
	columns: [
        {data: 'id', title: '#'}, //must have
    ],
  	columnDefs: [{
        sortable: false,
        class:    "index",
        targets:  0
    }],
    order: [[ 0, 'asc' ]],
})

table.on( 'order.dt search.dt', function () {
    table.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
      cell.innerHTML = i+1;
    });
}).draw();
iF n OnLy iF