oSettings is null when calling fnPagingInfo function

oSettings is null when calling fnPagingInfo function

kordhrufankordhrufan Posts: 1Questions: 1Answers: 0

I'm currently trying to solve a problem with my table.

I'm using JSTL to print an object list inside an object from my controller, displaying the result in multiple tables.

Everything is working well until I apply the datatable function in my javascript, resulting in Cannot read property '_iDisplayStart of null and when I check the function $.fn.dataTableExt.oApi.fnPagingInfoit appears that the oSettings is null.

This is my javascript code:

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);

This is my 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>

As you can see, I have an object called portals **that has a object list called **blocs, and when this object is not empty I create a for each that print the table equal the times it has items, then I print the item list contents inside the table. Its a object list inside an object list inside an object.

I don't know if it because there are multiple tables in the view page or I'm missing something else. what could I do?

Answers

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    Can you link to a page that shows the issue please?

    Thanks,
    Allan

This discussion has been closed.