When I did not load the data dynamically into the table I used this way to create the index column: link
p> t.on( 'order.dt search.dt', function () {
t.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
cell.innerHTML = i+1;
} );
} ).draw();
Example: link
However, now that I'm loading the table dynamically server-side does not work properly. It is always from 1 to 5. If you increase results per page add the index.
I tried to use it that way and I was not successful either:
t.on( 'order.dt search.dt', function () {
t.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
cell.innerHTML = i+1;
t.cell(cell).invalidate('dom');
} ); } ).draw();
I am studying jquery, laravel and server-side datatables use yet. I do not know how to solve this.