Get value of specific row&columns before any transforms (like fnRender) and draws

Get value of specific row&columns before any transforms (like fnRender) and draws

ttcottco Posts: 1Questions: 0Answers: 0
edited July 2012 in General
Hi all! I'm using Datatables 1.9.1, and am in need of assistance.
In the following table: http://i49.tinypic.com/2ivfv4n.jpg
in the [5] (Finish time) row I'd like to calculate the gap between the first ( aData[0] == "1" ) and the rest of the drivers, and so it also works when sorting by other columns. I have disabled the paging on this table, so the winners time is actually always returned in the result set. But, how can I store the winners time somewhere and use it to substract all other times. I have tried with some callback functions but it seemed kind of messy and I always got (when outputting the values with console.log) the times already transformed (fnRender), so i would get 45:55.911 instead of the original "pure" millisecond times I get from the database. The "core" of this query is as follows (I removed some unnecessary data to conserve space):
[code]
var hidden_columns = [7, 8, 9, 10];
if( comp_options.no_teams_competition == 1 ) {
hidden_columns = [2, 7, 8, 9, 10];
}
$('#results').dataTable( {
"bJQueryUI": true,
"sDom": '<"H"lfrp>t<"F"i>',
"bProcessing": true,
"bServerSide": true,
"bFilter": false,
"sAjaxSource": query_text,
"iDisplayLength": -1,
"aLengthMenu": [[-1], ["All"]],
"aoColumnDefs": [
{ "bVisible": false, "aTargets": hidden_columns },
{ "fnRender": function ( o, val ) {
return Math.floor( +o.aData[4] / +o.aData[9] ) - 1 + "+1";
}, "aTargets": [ 4 ]
},
{ "fnRender": function ( o, val ) {
if( isNaN(val) && o.aData[8] == 'DNF' ) {
return "";
} else {
return formatSeconds(val);
}
}, "aTargets": [ 5 ]
},
{ "fnRender": function ( o, val ) {
if( +o.aData[7] > 0 ) {
return o.aData[6] + "+" + o.aData[7];
} else {
return val;
}
}, "aTargets": [ 6 ]
},
{ "sClass": "bold right", "aTargets": [ 5 ] },
{ "sClass": "bold center", "aTargets": [ 6 ] },
{ "sWidth": "75px", "aTargets": [ 5 ] },
{ "sWidth": "45px", "aTargets": [ 0, 3, 4, 6 ] }
],
"fnRowCallback" : function(nRow,aData,iDisplayIndex) {
if(aData[0] == "1") {
$(nRow).addClass( 'gold' );
} else if(aData[0] == "2") {
$(nRow).addClass( 'silver' );
} else if(aData[0] == "3") {
$(nRow).addClass( 'bronze' );
}
}
} );
[/code]
This discussion has been closed.