How to print auto serial number in datatable?
How to print auto serial number in datatable?
anovob
Posts: 3Questions: 2Answers: 0
Hello all,
I've added one table and I tried to add an auto increment table row called "serial" for the serial number using the https://legacy.datatables.net/ref#fnRowCallback option, the code goes as:
"fnRowCallback" : function(nRow, aData, iDisplayIndex){
$("td:first", nRow).html(iDisplayIndex +1);
return nRow;
},
The serial number is coming, but the serial number is not showing in print, any one can please help me what to do now?
My Test https://jsfiddle.net/x3nq0zL4/1/
This discussion has been closed.
Answers
Hi @anovob ,
You can use orthogonal data for that. Your fiddle was giving me problems so I copied it to here, and it's doing what you want.
Cheers,
Colin
I just saw your other thread - please don't duplicate threads.
Hi @Colin,
The link you suggested is working fine but there is an issue in it. Our original list index start from 1 but in print the index start from 0.
Regards,
Asif Aziz
That just needs a
+1
here:See example,
Colin