I want to skip row rendering if a condition is met during its initialization, however I dont know where exactly to place it.
Should I put it in fnCreatedRow
or fnPreDrawCallback
?
And how can I do that?
Here is my code:
var users_tbl =$('#users_tbl');
users_tbl.DataTable({
"deferRender": true,
"autoWidth": false,
//for reinitialisation purpose
destroy: true,
"aLengthMenu": [[20, 40, 50, 100, -1], [20, 40, 50, 100, "All"]],
"order": [[ 0, "DESC" ]],
"ajax" : {
url : Main.Vars.host + "settings/get_users",
type : "GET",
},
"aoColumnDefs": [
{ "sWidth": "5%", "aTargets": [ 0 ] },
{ "sWidth": "20%", "aTargets": [ 1 ] },
{ "sWidth": "25%", "aTargets": [ 2 ] },
{ "sWidth": "15%", "aTargets": [ 3 ] },
{ "sWidth": "5%", "aTargets": [ 4 ] },
],
"fnCreatedRow" : function( nRow, aData, iDataIndex ){
$(nRow).addClass('item-context');
return false;
},
"fnPreDrawCallback": function( oSettings ) {
console.log(oSettings);
},
"columns": [
{
"data": "id",
},
{
"data": "username",
},
{
"render": function(data,type,row,meta) {
var owner = row.pnp_info.first_name + " " + row.pnp_info.last_name;
return owner;
}
},
{
"data": "created_on",
},
{
"render": function(data,type,row,meta) {
return row.active == 1 ? "YES" : "NO";
}
},
],
sPaginationType: "full_numbers",
});