Friday, December 7, 2012

How to Know If The DataTables is Running

That's just a tip for you guys who are working with the DataTables plug-in. If you need to know if the DataTables JS code is properly running, you can just pass a parameter to it to have a message box as result.

That's is really simples:
$(document).ready( function() {
   $('#example').dataTable( {
     "fnInitComplete": function(oSettings, json) {
       alert( 'DataTables has finished its initialisation.' );
   } );
} )

The fnInitComplete function is called when the Datatables finishes its initialization, so if that doesn't show up, you will be able to know that the plug-in haven't started.

I know that's quite simple, but this small code has helped me to find out an another big problem.

No comments:

Post a Comment