1
我使用的數據表,我想刪除選定行當點擊該行..
這裏對於datatabe
$('.data-table').dataTable({
"aaSorting": [],
"oLanguage": {"sSearch": ""},
"fnDrawCallback": function (oSettings) {}
});
這裏的代碼是刪除功能...
<input type="button" class="btndel btn-primary btn btn-primary" onclick=" $(this).closest('tr').addClass('selected');
if ($('.tab1').hasClass('active')) {
var rows = $('.data-table').dataTable().row('.selected').remove().draw();
var xSum = 0;
var items = document.getElementsByClassName('pp');
var itemCount = items.length;
var total = 0;
$('.pp').each(function() {
var che = isNaN($(this).text());
if (che == false) {
xSum += parseFloat($(this).text());
}
});
var value1 = xSum/parseInt(itemCount);
$('#avgsold').text(value1.toFixed(2));
}
if ($('.tab2').hasClass('active')) {}" value="Delete" />
但它給錯誤
Uncaught TypeError: $(...).dataTable(...).row is not a function
在此先感謝
您是否已經實施了圖書館? – NiZa
是的,我已經實現了數據表庫... –