我有一个脚垫需要清洁。我的意思是,我需要删除 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>
最佳答案
可以通过removeRows()
函数删除:
function removeRows(){
$(".footable>tbody>tr").each(function(index, elem){
$(elem).remove();
});
}
关于javascript - 如何删除 footable 中的所有行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25807324/