2017-04-25 17 views
0

我製作了一個Jade mixin來創建一個從我從節點傳遞的值的表。我在文檔準備好的情況下實例化dataTables,但我一直在收到「表中沒有數據」從DOM數據源創建來自pug mixin的數據表總是說「表中沒有可用的數據」

我有一種感覺,導致問題的兩者之間存在競爭條件。

這裏是哈巴狗

  table#brandPageTable.table.table-bordered.table-hover(name="Brands") 
      thead 
      tr 
       th Company Name 
       th Industry 
       th Contact Name 
       th Contact email 
       th Contact Phone Number 
      tbody 
      mixin liveCampaigns(brandID,name,type,contactName,contactEmail,contactPhoneNumber) 
      tr.clickable-row(data-url='/superUser/brands/'+brandID) 
       td=name 
       td=type 
       td=contactName 
       td=contactPhoneNumber 

      for brand in brands 
      +liveCampaigns(brand.id,brand.clientName,brand.businessType,brand.contactFirstName,brand.contactEmail,brand.contactPhoneNumber) 

這裏是JS

document.addEventListener("DOMContentLoaded", function(event) { 
    $('#BrandsTable').DataTable(); 
    }); 
+0

問題必須包含您的代碼的最小可行示例以及對您嘗試的內容的描述。 – sean

回答

0

對於運行到這個問題,這個問題是TBODY標籤的人。無論出於何種原因,哈巴狗正在創建兩個tbody標籤,並且dataTable將採用始終爲空的第一個正文

相關問題