不确定在这里使用 get 获取 dom 元素,有什么建议吗?
selected_received_id = $(this).parents('tr').data('id');
row_element = $(this).parents('tr');
received_table.fnDeleteRow(row_element.get());
不确定在这里使用 get 获取 dom 元素,有什么建议吗?
selected_received_id = $(this).parents('tr').data('id');
row_element = $(this).parents('tr');
received_table.fnDeleteRow(row_element.get());
尝试这个:
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
}
});
尝试这个
var nRow = $(tableid + ' tbody tr[id='+ rowid +']');
if (nRow.length > 0)
{
var oTable = $(tableid).dataTable();
oTable.fnDeleteRow(nRow[0],null,true);
}