fnPreDrawCallback seems to be called twice when creating a datatables object

fnPreDrawCallback seems to be called twice when creating a datatables object

chris_nchris_n Posts: 53Questions: 3Answers: 0
edited September 2011 in DataTables 1.8
fnPreDrawCallback seems to be called twice when creating a datatables object with the code below. Is this "normal" or am I missing something.

Kind Regards,
Chris


[code]
$(document).ready(function(){

oTable = $("#order").dataTable( {
"bProcessing": true,
"bServerSide": true,
"bAutoWidth" : false,
"bPaginate": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"sAjaxSource": "[% c.uri_for('/order/table') %]/[% order_num %]",
"aaSorting" : [[0, "desc"]],
"aoColumns": [
{ "sWidth": "5px" },
{ "sWidth": "5px" },
{ "sWidth": "25px" },
{ "sWidth": "75px" },
{ "sWidth": "10px" },
{ "sWidth": "10px" },
{ "sWidth": "10px" },
],
"fnPreDrawCallback": function() {
var row ='1----0--0.00';
this.fnAddTr($(row)[0], false); /* We must set redraw at false to prevent a tight-loop */
return true;
},
"fnDrawCallback": function() {
/* Apply the jEditable handlers to the table */
},
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
/* Row Foo */
},
"fnFooterCallback": function (nRow, aaData, iStart, iEnd, aiDisplay ) {
/* Footer Foo */
}
}, jEdit(oTable));

});

[/code]

Replies

  • chris_nchris_n Posts: 53Questions: 3Answers: 0
    Well, I dug a little deeper and came up with this from a previous post by Allan found here:

    http://www.datatables.net/forums/discussion/5756/earliest-pre-render-callback/p1

    [quote]fnPreDrawCallback will fire once for each draw of the table - the first time is when the DataTable has no data and shows a 'Loading...' message, and the second time is when it actually has data.

    fnRowCallback is called as each row is drawn onto the page, and then fnInitComplete is called when the table has fully initialised with the data loaded.[/quote]
This discussion has been closed.