Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82451

How To Reinitialize Datatable in Ajax

$
0
0

here is my code:

    if ($('#teamTable').size() > 0)
            {

             $('#teamTable').dataTable({
            "sPaginationType": "bootstrap",
            "bRetrieve": true,
            "bDestroy":true,//storing the instance of the dataTable for futher use in the future
            });
            }

and ajax code:

     $("#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().fnDestroy();
        callBack();
        });
        });

* no intialization of boostrap search and paging using datatable * when i click on button old boosrtap paging and search textbox has been removed .


Viewing all articles
Browse latest Browse all 82451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>