2016-11-21 43 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

謝謝,我會試試看。 –

相關問題