Set value on cell (td) with DrawCallback (server side)
Set value on cell (td) with DrawCallback (server side)
hernan84
Posts: 7Questions: 0Answers: 0
I'm trying to set a row number on a custom column (id=8) which works until you change the page. It seems that the "$('td:eq(8)', oSettings.aoData[ oSettings.aiDisplay[i] ].nTr ).html(i+1);" line doesn't work on a page change.
[code]
"fnDrawCallback": function ( oSettings ) {
if ( oSettings.bSorted || oSettings.bFiltered )
{
for ( var i=oSettings._iDisplayStart, iLen=oSettings.fnRecordsTotal() ; i
[code]
"fnDrawCallback": function ( oSettings ) {
if ( oSettings.bSorted || oSettings.bFiltered )
{
for ( var i=oSettings._iDisplayStart, iLen=oSettings.fnRecordsTotal() ; i
This discussion has been closed.
Replies
At first I realized that my for() cicle wasn't good as I had to sum the lenght and start values (oSettings._iDisplayLength + oSettings._iDisplayStart) for the cicle limit. Then I found that no matter the number of page you are the rows number start always from 0 so I had to use another counter begining in 0.
Final code:
[code]
"fnDrawCallback": function ( oSettings ) {
var k = 0;
var total = oSettings._iDisplayLength + oSettings._iDisplayStart;
for ( var i=oSettings._iDisplayStart, iLen=total ; i