selectItems
自:Select 1.0.0 起
Select 项类型更改事件。
请注意 - 此属性需要 DataTables 的 Select 扩展。
说明
每当要选择的项(行、列、单元格)发生更改时,便会触发此事件。这可以通过 select.items
初始化选项或 select.items()
API 方法来实现。
请注意,与所有 DataTables 发出的事件一样,此事件都由 dt
命名空间触发。因此,要监听此事件,还必须使用 dt
命名空间,方法是简单地将 .dt
追加到事件名称中(使用 on()
和 one()
时会自动执行此操作)。
类型
函数 函数(e, dt, items)
- 参数
名称 类型 可选 1 e
否 jQuery 事件对象
2 dt
否 DataTables API 实例
3 items
否 现在允许最终用户选择的项。请参见
select.items
。
示例
每当项选择类型发生更改时进行日志记录
12345var
table =
new
DataTable(
'#myTable'
);
table.on(
'selectItems'
,
function
(e, dt, items) {
console.log(
'Items to be selected are now: '
, items);
});
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.