Dynamic application of class styling to td division in a table row

Dynamic application of class styling to td division in a table row

chris_nchris_n Posts: 53Questions: 3Answers: 0
edited April 2010 in General
Hi all,

First post here, so the standard newbie disclaimer is hereby invoked.

Background:

I'm using a fnRowCallback to add a custom class to the td div of a given column in each table row. Here is the callback function:

[code]
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
if ( aData[7] >= 0 )
{
$('td:eq(7)', nRow).attr("class","currency");
}
return nRow;
}
[/code]

Then I am calling a JQ function from another library (unrelated to DataTables) to apply styling to that class dynamically. For reference, here is that call:

[code]
$('.currency').formatCurrency({ colorize:true, region: 'en-US' });
[/code]

I have tried calling this function immediately after calling the dataTable function and the styling does not apply. Both the dataTable and formatCurrency functions are called on the $(document).ready event.

Additionally, I use a fnFooterCallback to do some custom formatting on the footer as well as add a custom class to the td div of the above referenced column in the footer. Here I call the formatCurrency function at the end of the fnFooterCallback function and the styling applies properly, but *only* to the td div in the footer: not to the td div in the table body.

Any thoughts on what I'm doing wrong?

If more info/explanation is needed, just let me know.

Kind Regards,
Chris
This discussion has been closed.