{hero}

rows().delete()

从 Editor1.5.0 开始

删除多个现有行。
请注意 - 此属性需要 DataTables 的 Editor 扩展。

说明

此方法可用于使用 Editor 主表单删除一条或多条现有记录。它实质上是 remove() 方法的代理,通过 DataTables API 对象公开,使用 rows() 选择器选择要删除的行。

此方法使用的 Editor 实例是构建表格时引用该表格的最后一个 Editor 实例。仅在使用多个 Editor 实例时才重要此考虑因素!

请注意,此方法仅通过 DataTables API 公开了 Editor 的一小部分。Editor 有 其自己的扩展 API,用于完全控制该表单。

类型

函数 rows().delete( 选项 )

说明

使用主 Editors 表单删除 DataTable 中的行。

参数
返回

返回原始 API 实例,未经修改,以允许链接。

示例

删除当前页上的所有行

1
2
3
var myTable = new DataTable('#myTable');
 
myTable.rows({ page: 'current' }).delete();

删除带有“selected”类的所有行——明确设置表单标题

1
2
3
4
5
6
var myTable = new DataTable('#myTable');
var rows = myTable.rows('.selected');
 
rows.delete({
    title: 'Delete ' + rows.count() + ' rows'
});

删除选中的行,以取消按钮显示表单

1
2
3
4
5
6
7
8
9
10
11
12
13
14
var myTable = new DataTable('#myTable');
var rows = myTable.rows('.selected');
 
rows.delete({
    buttons: [
        {
            label: 'Cancel',
            fn: function () {
                this.close();
            }
        },
        'Delete'
    ]
});

相关

以下选项直接相关,在应用开发中也可能有用。

Comments (0)

No comments posted for this page yet. Be the first to contribute!

Post new comment

Contributions in the form of tips, code snippets and suggestions for the above material are very welcome. To post a comment, please use the form below. Text is formatted by Markdown.

To post comments, please sign in to your DataTables account, or register:

Any questions posted here will be deleted without being published.
Please post questions in the Forums. Comments are moderated.