How to reinitialize jquery Datatable

前端 未结 2 1381
暗喜
暗喜 2021-02-20 11:26

How to reinitialize a jQuery datatable? I even tried to remove table element. Still that table is displaying. My code is like this:

function removeExistingDat         


        
2条回答
  •  忘掉有多难
    2021-02-20 11:49

    You may use fnReloadAjax

    http://datatables.net/forums/discussion/256/fnreloadajax/p1

    oTable = $('#FTable').dataTable( {
         "bDestroy":true,
         "bJQueryUI": true,
        "sScrollX": "100%",
        "sScrollXInner": tablewidth+"px",
        "bScrollCollapse": true,
        "bSort":false,
        "iDisplayLength" : 50,
        "sPaginationType" : "full_numbers",
        "aLengthMenu": [[10, 18, 50, -1], [10, 18, 50, "All"]]
    } );
    
    function reinit(){
        oTable.fnReloadAjax( 'media/examples_support/json_source2.txt' );
    }
    

提交回复
热议问题