我有足够的脚步需要清洁。我的意思是,我需要删除footable中的所有行。有没有足够的功能可以做到这一点?或者我是否需要逐个删除行?
我尝试重新初始化表:
$('.footable').footable();
我也尝试过这样的行:
var footable = $('table').data('footable');
//This is the problem I don´t know how to get first row in the table.
var row = ??????.parents('tr:first');
var next=row.next();
for (var i=0; i<long-1; i++){
footable.removeRow(next);
next=row.next();
}
footable.removeRow(row);
我相应的html源代码:
<table class="footable footable-loaded">
<thead>
<tr>
<th>Cantidad</th>
<th>Producto</th>
<th>Precio</th>
<th>Eliminar</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<th></th>
<th>Total</th>
<th id="total">19.5</th>
<th></th>
</tr>
</tfoot>
</table>
答案 0 :(得分:3)
您可以按removeRows()
功能删除
function removeRows(){
$(".footable>tbody>tr").each(function(index, elem){
$(elem).remove();
});
}
<强> DEMO 强>
答案 1 :(得分:0)
尝试这个
footable.rows.load([])