You can use the fnDrawCallback
function. It gets called every time the table is drawn. This would include when the table is loaded with data, sorted or filtered.
You better use fnInitComplete
:
$(document).ready(function () {
$('#example').dataTable({
"fnInitComplete": function (oSettings, json) {
alert('DataTables has finished its initialisation.');
}
});
})