fnPreDrawCallback seems to be called twice when creating a datatables object
fnPreDrawCallback seems to be called twice when creating a datatables object
chris_n
Posts: 53Questions: 3Answers: 0
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]
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]
This discussion has been closed.
Replies
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]