jQuery DataTables 清除 table 除了第一行

jQuery DataTables clear table except the first row

我正在使用 jquery 数据table。我想清除 table 除了第一行。

 var table = $('tableId').DataTable({});

样本:
tr1
tr2
tr3

table.clear().draw(); //This clear all rows, How do I exclude first row

清除table:
tr1

怎么样 - 我使用 .rows().remove() 而不是 .clear(),所以我可以 select 应该删除哪些行。

$('#deleteAll').click(function(){
    //get first element
    var firstElement = $('tbody > tr').first();

    /*remove all <tr> which are coming after the first element and
    redraw the table */
    table.rows(firstElement.nextAll('tr')).remove().draw();
});

Fiddle