0

不确定在这里使用 get 获取 dom 元素,有什么建议吗?

selected_received_id = $(this).parents('tr').data('id');
row_element = $(this).parents('tr');
received_table.fnDeleteRow(row_element.get());
4

2 回答 2

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
    }
});
于 2013-05-06T06:02:45.180 回答
0

尝试这个

var nRow =  $(tableid + ' tbody tr[id='+ rowid +']');

if (nRow.length > 0)
{
    var oTable = $(tableid).dataTable();
    oTable.fnDeleteRow(nRow[0],null,true);
}
于 2013-05-05T22:58:45.083 回答