Arasu Arasu - 4 months ago 14
Javascript Question

How to Call a javascript function after SAjaxsource completes in JQuery Datatables

I'm using JQuery SAjaxsource How can i Call a javascript function after SAjaxsource completes. I want to update a div after the completion of the datatable load.Please help me...

Edit:

$(document).ready( function() {
var oTable = $('#example').dataTable( {

"bServerSide": true,
"sSearch":false,
"aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
"bPaginate": true,
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sAjaxSource": "server_processingCDB1.php"
} );

Answer

http://datatables.net/ref#fnDrawCallback also works for this, and saved you needing to override fnServerData.

Parameter: fnDrawCallback

Type: function

Inputs: {object}: DataTables settings object

This function is called on every 'draw' event, and allows you to dynamically modify any aspect you want about the created DOM.

$(document).ready( function() {
  $('#example').dataTable( {
    "fnDrawCallback": function( oSettings ) {
      alert( 'DataTables has redrawn the table' );
    }
  } );
} );
Comments