jquery - How To Reinitialize Datatable in Ajax -


what need

*when ajax loaded datable reintailized.

ajax call code:

   if ($('#teamtable').size() > 0)     {          $('#teamtable').datatable({             "spaginationtype": "bootstrap"         });     }        $("#save_team").click(function() {             $.ajax({             type: "post",             url: "asana_team.php",             data: { people_name: $('#e2').val(), team_name:$('#teamname').val() },             beforesend : function(){                 $("#team_table").remove();                 $("#team_table_div").append("<center id=\"loading\" style=\"margin-top:25%;margin-bottom:25%\"><img src='../common/images/ajax-loader.gif' /></center>");             },             contenttype: "application/x-www-form-urlencoded"             }).done(function(data) {                 $("#loading").remove();                 $('#team_table_div').append(data);                 $('#teamtable').datatable({                     "spaginationtype": "bootstrap"                 });                                 });         }); 

* working fine reintializing pagination in datatable no datable loaded.

  • i have used code reinitailize table.

     function callback()  {  var call= $('#teamtable');  call.datatable({  "spaginationtype": "bootstrap",  "sdom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",  "olanguage": {  "slengthmenu": "_menu_ records per page"  } }); } $(document).ready(function() { callback(); }); 

destroy first using

    $('#teamtable').datatable().fndestroy(); 

then reinitailize

    $('#teamtable').datatable(); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -