user6556472 user6556472 - 25 days ago 4
jQuery Question

jquery datatable - How to use render function get data from another column

I have add button in each row ,but I want to check if info column data is N/A, then not shown the button, I have try to set render as below in my code ,but it's not work

{
"targets": -1,
"data": null,
"render": function ( data, type, row )
{
if (row.info != 'N/A') {
return "<button href='" + row.index() + "' class='btn btn-info'>View</button>"
} else { return "" }
}
}
}


Any help/advice is greatly appreciated.
Willing to post any more information if it will help.

Answer

Working Link Here

"render": function(data, type, full, meta ) {
    if (full.info != 'N/A') {
        return "<button href='" + row.index() + "' class='btn btn-info'>View</button>"
    } else {
        return ""
    }
}
Comments