Attempting to use deferred rendering, but all rows being rendered on initialization
Attempting to use deferred rendering, but all rows being rendered on initialization
I'm using Datatables 1.9.4 and looking for a speed improvement via deferred rendering.
I have bDeferRender: true, but I see my fnRender called for each row of each column for which it is defined during the initialization below even though all rows are not visible.
Here is the Datatable init code. I've tried commenting out many of these settings, but still get the same results.
[code]
table = $('#my-table').dataTable({
"aoColumns": [
{ "sWidth": "15%", "sType": "string"},
{ "sType": "string"},
{
"bSortable": false,
"bSearchable": false,
"sWidth": "15px",
"fnRender": function (oObj) {
return 'bunch of stuff';
}
},
{
"bSortable": false,
"bSearchable": false,
"sWidth": "15px",
"fnRender": function (oObj) {
return 'bunch of stuff';
}
},
{ "bSortable": false, "bSearchable": false, "bVisible": false },
{ "bSortable": false, "bSearchable": false, "bVisible": false },
{ "bSortable": false, "bSearchable": false, "bVisible": false }
],
"aaData": tableData,
"bAutoWidth": false,
"aaSorting": [[1, "asc"]],
"sScrollY": "11em",
"sScrollX": "100%",
"bPaginate": false,
"bScrollCollapse": true,
"bLengthChange": false,
"bFilter": true,
"bInfo": false,
"sDom": "lrtip",
"bDeferRender": true
"oLanguage": {
"sZeroRecords": PM.resource.tableEmpty
},
"fnRowCallback": function (nRow, aData, iDisplayIndex) {
$(nRow).attr('id', 'row-' + aData[6]);
return nRow;
}
});
[/code]
});
I have bDeferRender: true, but I see my fnRender called for each row of each column for which it is defined during the initialization below even though all rows are not visible.
Here is the Datatable init code. I've tried commenting out many of these settings, but still get the same results.
[code]
table = $('#my-table').dataTable({
"aoColumns": [
{ "sWidth": "15%", "sType": "string"},
{ "sType": "string"},
{
"bSortable": false,
"bSearchable": false,
"sWidth": "15px",
"fnRender": function (oObj) {
return 'bunch of stuff';
}
},
{
"bSortable": false,
"bSearchable": false,
"sWidth": "15px",
"fnRender": function (oObj) {
return 'bunch of stuff';
}
},
{ "bSortable": false, "bSearchable": false, "bVisible": false },
{ "bSortable": false, "bSearchable": false, "bVisible": false },
{ "bSortable": false, "bSearchable": false, "bVisible": false }
],
"aaData": tableData,
"bAutoWidth": false,
"aaSorting": [[1, "asc"]],
"sScrollY": "11em",
"sScrollX": "100%",
"bPaginate": false,
"bScrollCollapse": true,
"bLengthChange": false,
"bFilter": true,
"bInfo": false,
"sDom": "lrtip",
"bDeferRender": true
"oLanguage": {
"sZeroRecords": PM.resource.tableEmpty
},
"fnRowCallback": function (nRow, aData, iDisplayIndex) {
$(nRow).attr('id', 'row-' + aData[6]);
return nRow;
}
});
[/code]
});
This discussion has been closed.
Replies
The other thing is that you've disabled pagination, so all rows must be drawn - thereby making the deferred rendering irrelevant!
Allan