Datatables clear tbody

前端 未结 4 947
一整个雨季
一整个雨季 2021-02-04 04:45

I have a HTML table that I fill with data from an AJAX jQuery call.This table uses the jQuery plugin - datatables for paging, sorting and so on.

The jQuery call gets cal

4条回答
  •  情歌与酒
    2021-02-04 05:14

    I think what you're looking for is this piece of code:

    var oSettings = $('#table').dataTable().fnSettings();
    var iTotalRecords = oSettings.fnRecordsTotal();
    for (i=0;i<=iTotalRecords;i++) {
       $('#table').dataTable().fnDeleteRow(0,null,true);
    }
    

    Source: http://www.datatables.net/forums/discussion/comment/15862

提交回复
热议问题