fnRowCallback blowing up under zero configuration conditions...

fnRowCallback blowing up under zero configuration conditions...

jdbjdb Posts: 9Questions: 0Answers: 0
edited November 2010 in General
Good evening,

I'm a noob thinking fnRowCallback might be the answer to a project requirement. When I placed it in my code it blew things up so I started skinning things down to the basics to make sure it wasn't my code. I don't think it is. After all was removed I'm left with this:
[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">





$(document).ready(function() {
oTable = $('#mytable').dataTable({
"fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
alert( 'DataTables has redrawn the row' );
}
});
});


Row Callback Test





Product
Price




Current Row Callback
0.05


Working Row Callback
Perhaps Priceless

Replies

  • cdaiglecdaigle Posts: 57Questions: 0Answers: 0
    Hi Jeff,

    The fnRowCallback needs to return a row. In this case, you want to just return nRow right away. (Later on you can modify it first as needed).

    Change the following:
    [code]
    $(document).ready(function() {
    oTable = $('#mytable').dataTable({
    "fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
    alert( 'DataTables has redrawn the row' );
    }
    });
    });
    [/code]
    to
    [code]
    $(document).ready(function() {
    oTable = $('#mytable').dataTable({
    "fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
    return nRow; //alert( 'DataTables has redrawn the row' );
    }
    });
    });
    [/code]

    This will definitely get rid of the first error, but I'm not 100% sure about the second.
    See here for further documentation on the fnRowCallback function: http://datatables.net/usage/callbacks#fnRowCallback

    Hope this helps.
  • jdbjdb Posts: 9Questions: 0Answers: 0
    Cd,

    That was it. Thank you very much for helping!

    Live and learn!
This discussion has been closed.