不确定在这里使用get to get dom元素,有什么建议吗?
selected_received_id = $(this).parents('tr').data('id');
row_element = $(this).parents('tr');
received_table.fnDeleteRow(row_element.get());
答案 0 :(得分:0)
试试这个
var nRow = $(tableid + ' tbody tr[id='+ rowid +']');
if (nRow.length > 0)
{
var oTable = $(tableid).dataTable();
oTable.fnDeleteRow(nRow[0],null,true);
}
答案 1 :(得分:0)
试试这个:
selected_received_id = $(this).parents('tr').data('id');
var iPos = oTable.fnGetPosition(row_element);
if (iPos !== null) {
oTable.fnDeleteRow(iPos);//delete row
}
或者这个:
$(".datatable tbody").delegate("tr", "click", function () {
var iPos = oTable.fnGetPosition(this);
if (iPos !== null) {
oTable.fnDeleteRow(iPos);//delete row
}
});