Update datatables (JQuery) when button is clicked

后端 未结 5 2018
夕颜
夕颜 2021-02-09 01:46

I\'ve created a simple form and I\'m using the Datatables jQuery plugin to display some data in it. Data are being populated by a php script (process.php) which returns the prop

5条回答
  •  猫巷女王i
    2021-02-09 02:39

    You could alternatively just destroy the table and recreate it too.

    var oTable = null;
    
    function reloadTable() {
        if (oTable) {
            oTable.fnDestroy();
        }
    
        oTable = $('#example').dataTable( {
            "sPaginationType": "full_numbers",
            "iDisplayLength": 10,
            //"bServerSide": true,
            "sAjaxSource": "process.php"
        } );
    }
    
    reloadTable();
    

提交回复
热议问题