【问题标题】:Datatable select event not triggering数据表选择事件未触发
【发布时间】:2017-03-27 08:48:49
【问题描述】:

我有以下代码从数据库中获取数据并显示为表格。

var tables = $('#factsTable')
.DataTable({
    "aProcessing": true,
    "aServerSide": true,
    "ajax": "includes/get-infacts.php",
})
.on('preInit.dt', function (e, settings) {
    console.log('preInit.dt');
})
.on('init.dt', function () {
    console.log('init.dt');
})
.on('draw.dt', function () {
    console.log('draw.dt');
})
.on('search.dt', function () {
    console.log('search.dt');
})
.on('select', function ( e, dt, type, indexes ) {
    console.log('data table select');
});

在这段代码中,除了“选择”侦听器之外,所有其他事件侦听器都在为我工作。

我不知道为什么不起作用。

【问题讨论】:

  • 您的选项中需要有select: true,否则不会执行任何选择,也不会触发任何事件
  • @davidkonrad 是的。有效。谢谢

标签: datatables-1.10


【解决方案1】:

.dt”不见了..

.... .on('select.dt', function (e, dt, type, index) { console.log('数据表选择');

【讨论】:

    猜你喜欢
    • 2019-05-18
    • 2023-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多