2014-05-12 19 views
1

我在同一頁上2個jQuery的數據表,他們不會加載一起多jQuery的數據表 - 只有一個會載入

第一張表加載,但第二個表與「處理圖標」和服務器掛起如果你在開發人員的網絡部分尋找數據,從來沒有調用過腳本腳本吧

如果我離開頁面上的第一個表,但不加載其數據,第二個數據表加載絕對正常。這就好像我不能有2個datatables與服務器端處理

這裏是加載文件準備好的表的代碼。正如我所說我已確認他們都加載獨立

 var btable = $('#branchesdt').DataTable({ 
     "processing": true, 
     "serverSide": true, 
       "sPaginationType": "full_numbers", 
     "columns": [ 
      { "data": "branch_name" }, 
      { "data": "branch_email" }, 
      { "data": "tel" }, 
      { "data": "fax" }, 
      { "data": "address1" }, 
         { "data": "address2" }, 
      { "data": "town" }, 
      { "data": "city" }, 
      { "data": "county" }, 
      { "data": "postcode" }, 
         { "data": "country_name" }, 


      {"data": null, 
        "defaultContent": "<button>Click!</button>" 
         } 

      ], 
      "ajax": "DataTables/branches_dt.php" 


    } 

     ); 


    var etable = $('#employeesdt').DataTable( 


      { 

     "processing": true, 
     "serverSide": true, 
       "sPaginationType": "full_numbers", 
       "ajax": "DataTables/employees_dt.php", 
     "columns": [ 
      { "data": "employee_name" }, 
         { "data": "position" }, 
      { "data": "employee_email" }, 
      { "data": "tel" }, 
      { "data": "fax" }, 
      { "data": "mobile" }, 
         { "data": "last_contact_date" }, 
      {"data": null, 
        "defaultContent": "<button>Click!</button>" 
         } 

      ] 

     }   
    ); 

在此先感謝您的專家可以給任何幫助。非常感謝

回答

0

你正在使用哪個版本的數據表? 我使用版本1.9.4。嘗試使用這個版本用下面的調用代碼:

dt = $('#branchesdt').dataTable({ 
     "bProcessing": true, 
     "bServerSide": true, 
     "sAjaxSource": "DataTables/employees_dt.php", 
     "iDisplayLength": 50, 
     "aaSorting": [ 
      [9, "desc"] 
     ]}); 

同樣爲您的第二個表

相關問題