使用数据表删除特定行

Removing specific row using datatables

我想从我的 table 中删除一行,这些行是使用服务器端处理添加的,我有一个删除按钮,其 ID 是数据库中该行的 ID。单击删除按钮后,该行正在从数据库中删除,但不是从 table.Also 到整行,这里分配了一个 id = "row_" 行 ID。

使用下面的代码,我如何从 table 中删除该行或将其淡出:

$('#users_table tbody').on( 'click', '.btn-delete', function () {
    var id = $(this).attr('id');
    var rowid = '#row_'+id;
    var sure = confirm("Are you sure you want to delete this user?");
    if (sure == true){
        $.ajax({
            type: "POST",
            url  : '../core/ajaxpdo.class.php',
            data: 'delete_user_id=' + id,
            success: function (response) {
                if (response=='ok'){


                }else{
                    operation_error();
                }
            },
            error: function() {
                alert('Something went wrong!');
            }
        });
        return false;
    }       
});

尝试了成功函数,但其​​中 NONE 满足了我的需求(它正在从数据库中删除,而不是从 table 中删除)

$('#users_table').dataTable().fnDeleteRow(rowid);

var linha = $(this).closest('tr');
linha.fadeOut(400, function () {
    tabelaP.row(linha).remove().draw()
});

var table = $('#users_table').dataTable();
table.fnDeleteRow( table.$(rowid)[0] ).draw();

在更改分页时它会删除该行,那么我该怎么做呢?服务器端有刷新或其他东西吗?

尽管经过大量尝试后,删除行,ajax 重新加载无法正常工作,因为我使用 PIPELINE data.So 来刷新 ajax 而不丢失分页,我有到 clear the pipeline cache 然后重新加载当前数据表页面效果很好:

// CLEARING THE CACHE
$("#users_table").DataTable().clearPipeline();

// RELOAD CURRENT DATATABLES PAGE WITHOUT LOSING PAGINATION
$("#users_table").DataTable().ajax.reload(null, false );

并且无需删除特定行,因为删除后数据会刷新!

更新:

用于删除特定 tr with specific id :

var id = 'row id here';
var rowid = '#row_'+id;
$("#users_table tbody").find(rowid).remove();