2016-11-21 74 views
0

初始化自定义表单对象您可以将静态表格对象等选择&输入数据表列如下所示: https://datatables.net/examples/api/form.html无法在第二页的数据表

但我想添加自定义的引导部件。像TouchSpin在这里找到: http://www.virtuosoft.eu/code/bootstrap-touchspin/

当我初始化TouchSpin只初始化显示第一页的数据表上的对象,在第二/第三页的对象不被初始化。

任何人有一个想法如何解决这个问题?可能是因为第二/三页不是DOM的一部分呢?

回答

0

你需要挂钩的是“drawCallback”函数。您可以在创建DataTable时在选项中指定它。它看起来像这样:

var table = $('#example').DataTable({ 
    //... Your other options ... // 
    drawCallback: function(settings) { 
     // This callback is called when the draw is complete which happens on: 
     // paging, sorting, and of course when you call ".draw()". The current 
     // DataTable page is in the DOM with all the HTML. 

     // You can get the jquery element for the table like this. 
     var dataTableJqueryObj = $(this); 

     // You can get the API object like this. 
     var apiDataTableObj = this.api(); 

     // Initialize your controls ...   
    } 
}); 

让我知道如果您有任何其他问题。

+0

谢谢,我会试试看。 –

相关问题