0
When I did not load the data dynamically into the table I used this way to create the index column: https://datatables.net/examples/api/counter_columns.html
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: https://jsfiddle.net/umn75pj1/
However, now that I am loading the dynamically server-side table does not work properly. It is always from 1 to 5. If I increase results per page add the index.
I tried to use it that way and I didn’t succeed 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’m studying jquery, Laravel and the server-side usage of datatables yet. I don’t know how to solve this.