【问题标题】:fire angular datatables page event触发角度数据表页面事件
【发布时间】:2014-12-01 06:48:27
【问题描述】:

我需要在数据表的页面更改事件中从服务器加载数据。我是using angular-datatables.min.js。但是can not seem to latch on to the page.dt event of the datables through angular scope。请帮我解决这个问题。

【问题讨论】:

  • 没有错误。我只是不知道如何使用角度范围调用事件。相当于:$('#example').dataTable().on('page', function( e, o) { // 对表格进行分页时做一些事情 } );

标签: angularjs pagination datatables


【解决方案1】:

不确定你是否让它工作了——但这就是我必须做的。可能不是最优雅的,但我能够捕捉到 colum-sizing.dt 事件:

$scope.$on('event:dataTableLoaded', function (event, loadedDT) {
    // loadedDT.DataTable is the DataTable API instance
    // loadedDT.dataTable is the jQuery Object
    loadedDT.DataTable.on('column-sizing.dt', function(e, settings) {
        console.log('WOOOHOOOO');
    });
});

我捕获了加载数据表时触发的 angular-datatables 事件,然后我在那里绑定数据表事件。

【讨论】:

  • 感谢瑞恩·德罗斯特!我没有意识到角度数据表会触发自己的事件“事件:dataTableLoaded”。已投票 +1
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-08-14
  • 2017-10-08
  • 2021-11-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多