{hero}

选择

自:选择 1.0.0

选择配置对象。
请注意 - 此属性需要 选择DataTables 的扩展。

说明

此选项用于在初始化 DataTable 期间配置 DataTables 的选择扩展。

当选择已加载到页面上时,该页面上的所有 DataTable 都具有选择项的功能,但默认情况下只能通过 API 来完成 - 即,默认情况下用户将无法在表中选择项。要启用用户选择,应该使用此选项(select.style() 方法也可以在初始化后使用)。

用户可以进行哪些选择以及如何选择取决于所选择的选项。

类型

布尔值

说明

使用操作系统选择样式启用用户选择(即,类似于操作系统中的文件列表,它通过 cmd/ctrl 和 shift 修饰键选项提供单击选项。请参阅 select.styleselect.items)。

字符串

说明

使用该字符串定义的选择样式启用用户选择。有关可用选项,请参阅 select.style

对象

说明

选择精细化初始化控制,允许完全配置选择选项。有关详细信息,请参考初始化选项。

示例

启用操作系统样式的行选择

1
2
3
new DataTable('#myTable', {
    select: true
});

启用单行选择

1
2
3
new DataTable('#myTable', {
    select: 'single'
});

禁用表信息元素中显示的选择摘要信息。

1
2
3
4
5
new DataTable('#myTable', {
    select: {
        info: false
    }
});

选择不显示摘要信息的单元格

1
2
3
4
5
6
new DataTable('#myTable', {
    select: {
        items: 'cell',
        info: false
    }
});

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.