Javascript 调用fnPagingInfo函数时,oSettings为null

Javascript 调用fnPagingInfo函数时,oSettings为null,javascript,twitter-bootstrap,spring-mvc,datatable,jstl,Javascript,Twitter Bootstrap,Spring Mvc,Datatable,Jstl,我目前正试图解决我的桌子的一个问题 我正在使用JSTL打印控制器中对象内部的对象列表,并在多个表中显示结果 在javascript中应用datatable函数之前,一切都正常工作,导致无法读取属性'\u iDisplayStart of null,当我检查函数$.fn.dataTableExt.oApi.fnPagingInfo时,oSettings似乎为null 这是我的javascript代码: var oInit ={ 'sDom': "<'datatable

我目前正试图解决我的桌子的一个问题

我正在使用JSTL打印控制器中对象内部的对象列表,并在多个表中显示结果

在javascript中应用datatable函数之前,一切都正常工作,导致
无法读取属性'\u iDisplayStart of null
,当我检查函数
$.fn.dataTableExt.oApi.fnPagingInfo
时,oSettings似乎为null

这是我的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);
var-oInit={
“sDom”:“t”,
“bAutoWidth”:假,
“bFilter”:错误,
“bLengthChange”:正确,
“iDisplayLength”:10,
“阿伦提努”:[1,5,10,15,50,100],
“sPaginationType”:“引导”,
“aoColumns”:aoColumns,
“语言”:语言,
'aaSorting':[[2,'desc']]
};
$('table#tabla _paginada _obtener _portales')。数据表(oInit);
var buttonCustom=$(“#buttonCustom”);
var buttonPlaceholder=$(“.dataTables_rango”);
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>

标题
描述



如您所见,我有一个名为门户的对象,它有一个名为blocs的对象列表,当该对象不为空时,我为每个对象创建一个与它的项目打印次数相等的表,然后我打印项目列表内容。它是一个对象中的列表


我不知道这是因为查看页面中有多个表,还是我缺少了其他内容。我能做什么呢?

我设法找到了解决方案,它非常简单,问题出在JSP中,每个函数的标记都必须在外部

像这样:

<tbody>
    <c:forEach var="item" items="${bloque.items}">
        <c:if test="${not empty item }">
            <tr>
                <td><c:out value="${item.titol}" /></td>
                <td><c:out value="${item.descripcio}" /></td>
            </tr>
        </c:if>
    </c:forEach>
</tbody>

标记用于将HTML表中的正文内容分组,在For each中,datatable无法进行分页,因为它经常重复,代码混乱