Confused about DeferedRender and mRender

Confused about DeferedRender and mRender

derchrisderchris Posts: 1Questions: 0Answers: 0
edited October 2013 in DataTables 1.9
Hi,

first post - hello everybody :)

Basically this is is my initialisation code:

[code]
oTable = $('#Items').dataTable({
"aaSorting": [[1, "desc"]],
"bSortClasses": false,
"bDeferRender": true,
"bProcessing": true,
"sAjaxSource": 'Overview.aspx?GetItems=1',
"fnServerData" : function ( sSource, aoData, fnCallback, oSettings ) {[shortened] },
"aoColumns": [
{ mData: 'BankbewegungID' },
{
mData: 'Datum'
},
{ mData: 'Kontaktname' },
{ mData: 'Verwendungszweck' },
{ mData: 'Betrag' },
{ mData: 'Art' }
],
"fnCreatedRow": function( nRow, aData, iDataIndex ) {
console.log("created");
},
"aoColumnDefs": [
{
"aTargets": [1],

"mRender": function (data, type, full) {
console.log("rendering");
return moment(data).format('L');
}


},
{
"aTargets": [4],

"mRender": function (data, type, full) {
console.log("mRender");
return formatCurrency(data);
},
sType: "currency"


}
[/quote]

Now the strange thing is that i got the following console messages in Firebug:
mRender [1774 times, I can see it counting up]
mRender
created
mRender
created
mRender
created
mRender
created
mRender
created
mRender
created
mRender
created
mRender
created
mRender
created
mRender
created
mRender [1773 times, I can see it counting up]

so I got 1773 items in total, so where this number comes from is clear to me. But: Using DeferendRender, why is mRender called so many times? I would have expected (having 10 items per page) that I initially will see a console log of 10 times mRender, Created

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Because the data for sorting and filtering needs to be obtained, even if the row is not displayed (DataTables needs to work out if the row should be displayed!).

    Allan
This discussion has been closed.