2015-04-01 57 views
1

我正在使用jQuery DataTables在同一页中的两个单独的表中填充数据。但是,我收到以下错误:错误与JQuery数据表oCol是未定义对话框

oCol is undefined

..在对话框中。请帮我解决this.This是我的代码:

<table class="assignment"> 
<tr> 
<th>Available Product License Types</th> 
<th></th> 
<th>Assigned Product License Types</th> 
</tr> 
<tr> 
<td class="leftcontent"> 
Select: <a href="#" onclick="return ASLM.Datatables.selectAll ($('#availableProductLicenseTypeTable'));">all</a>,       <a href="#" onclick="return ASLM.Datatables.selectNone($('#availableProductLicenseTypeTable'));">none</a>   <table id="availableProductLicenseTypeTable" class="display small noshadow"> 
<thead> 
<tr> 
<th>ID</th> 
<th>Name</th> 
<th>View Only</th> 
</tr> 
</thead> 
<tbody> 
<c:forEach var="availableProductLicenseType" items="${availableProductLicenseType}"> 
<tr> 
<td> 
${availableProductLicenseType.id} 
</td> 
<td> 
          ${availableProductLicenseType.productFamilyName}${' '}${availableProductLicenseType.productName} 
          <c:choose> 
           <c:when test="${availableProductLicenseType.needsExplicitAssignment}">*${availableProductLicenseType.licenseTypeName} 
           </c:when> 
           <c:otherwise>${availableProductLicenseType.licenseTypeName} 
           </c:otherwise> 
          </c:choose> 
         </td> 
         <td>${availableProductLicenseType.isViewOnly} 
         </td> 
        </tr> 
       </c:forEach> 
      </tbody> 
      </table> 
     </td> 

     <td class="buttons"> 
     <input type="button" value="&gt;" onclick="moveProductLicenseTypesAvailableToAssigned()"/></br> 
     <input type="button" value="&lt;" onclick="moveProductLicenseTypesAssignedToAvailable()"/></br> 
    </td> 
    <td class="rightcontent"> 
     Select: <a href="#" onclick="return ASLM.Datatables.selectAll($('#assignedProductLicenseTypeTable'));">all</a>, 
       <a href="#" onclick="return ASLM.Datatables.selectNone($('#assignedProductLicenseTypeTable'));">none</a> 
     <table id="assignedProductLicenseTypeTable" class="display small noshadow"> 
       <thead> 
       <tr> 
         <th>ID</th> 
         <th>Name</th> 
         <th>View Only</th> 
         </tr> 
       </thead> 
       <c:forEach var="assignedProductLicenseType" items="${assignedProductLicenseType}"> 
        <tr> 
         <td> 
          ${assignedProductLicenseType.id} 
         </td> 
         <td> 
          ${assignedProductLicenseType.productFamilyName}${' '}${assignedProductLicenseType.productName} 
          <c:choose> 
           <c:when test="${assignedProductLicenseType.needsExplicitAssignment}">*${assignedProductLicenseType.licenseTypeName} 
           </c:when> 
           <c:otherwise>${assignedProductLicenseType.licenseTypeName} 
           </c:otherwise> 
          </c:choose>               

          <input type="checkbox" name="isViewOnly" id="isViewOnlyId" value="${assignedProductLicenseType.isViewOnly}" /> 
          </td> 
          <td>${assignedProductLicenseType.isViewOnly} 
          </td> 
          </tr> 
       </c:forEach> 
      </table> 
     </td> 
    </tr> 
</table> 
+0

编辑与适当的代码格式化你的问题。 – D4V1D 2015-04-01 15:16:48

+0

在之后添加标签 – cura 2015-04-01 15:18:29

+0

我已经添加了标签,但它仍然给出相同的错误。 – Somekindofcoder 2015-04-01 15:34:43

回答

0

的DataTable希望这种格式:

<table> 
    <thead> 
     <tr> 
     <td>Col 1 head</td> 
     <td>Col 2 head</td> 
     <td>Col 3 head</td> 
     </tr> 
    </thead> 
    <tbody> 
    <tr> 
     <td>Col 1 body</td> 
     <td>Col 2 body</td> 
     <td>Col 3 body</td> 
    </tr> 
    </tbody> 
    </table> 
+0

是的,我只用这种格式: – Somekindofcoder 2015-04-01 16:00:18

+0

您发布的代码并不这么说...编辑代码!你在另一张桌子里有一张桌子,其中有一张是这种格式的! – JuaRoAl 2015-04-01 16:03:48

+0

在上面的代码中,如果我要评论仅查看及其相应的数据列,弹出窗口不会出现,但由于我需要此列,因此我添加了它,并添加了它会给出错误。会有其他原因吗? – Somekindofcoder 2015-04-01 16:04:50