我现在正在用我的桌子解决一个问题。
我正在使用JSTL从控制器中打印对象内部的对象列表,并将结果显示在多个表中。
在我在JavaScript中应用dataTable函数之前,一切都正常工作,结果
Cannot read property '_iDisplayStart of null
当我检查功能时
$.fn.dataTableExt.oApi.fnPagingInfo
OSettings似乎为空。
这是我的javascript代码:
var oInit ={
'sDom': "<'datatables-action-box'<'span6 link-tabla'r><'span18 link-tabla'l>>t<'datatables-action-box'<'span2 link-tabla'i><'span2'p>>",
'bAutoWidth': false,
'bFilter': false,
'bLengthChange': true,
'iDisplayLength': 10,
'aLengthMenu': [1, 5, 10, 15, 50, 100],
'sPaginationType': 'bootstrap',
'aoColumns': aoColumns,
'oLanguage': oLanguage,
'aaSorting': [[2,'desc']]
};
$('table#tabla_paginada_obtener_portales').dataTable(oInit);
var buttonCustom = $("#buttonCustom");
var buttonPlaceholder = $(".dataTables_rango");
buttonPlaceholder.html(buttonCustom);
这是我的JSP:
<c:if test="${not empty portals}">
<c:forEach var="bloque" items="${portals.blocs}">
<c:choose>
<c:when test="${not empty bloque.items}">
<table id="tabla_paginada_obtener_portales" class="table">
<thead>
<tr>
<th>Title</th>
<th>Description</th>
</tr>
</thead>
<c:forEach var="item" items="${bloque.items}">
<c:if test="${not empty item }">
<tbody>
<tr>
<td><c:out value="${item.titol}" /></td>
<td><c:out value="${item.descripcio}" /></td>
</tr>
</tbody>
</c:if>
</c:forEach>
</table>
<br>
</c:when>
<c:otherwise>
<spring:message code="checklist.obtenerPortal.tabla.noresult" />
<br>
<br>
</c:otherwise>
</c:choose>
</c:forEach>
</c:if>
如你所见,我有一个叫
门户
有一个对象列表
区块
当这个对象不为空时,我为每个打印表的对象创建一个
项目
,然后我打印项目列表内容。它是一个对象内部的列表。
我不知道是因为视图页中有多个表,还是我遗漏了其他内容。我能做什么?