0

I was using a plugin previously for pagination that was jQuery paginate but since it was just limited to pagination I decided to switch to the one at http://datatables.net but when I apply it just like the tutorial says to it appears a line sayng that there is No data available in table, and that is Showing 0 to 0 of 0 entries here is my html and how Im trying to sort this out

<%@ include file="/template/jstl.jsp"%>
<html>
<title></title>
<head>
<script type="text/javascript" src="${ctx}/js/jquery/jquery-1.7.2.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery/jPaginate.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery/jquery.dataTables.js"></script>
<script type="text/javascript" src="${ctx}/js/device/device.js"></script>

</head>
<body>

<div class="titulo">Lista de Dispositivos</div>
    <table class="device" id="table_id">
        <thead>
            <tr>
                <th >Nome</th>
                <th >Código</th>
                <th >Ações</th>
                <th >Excluir</th>

            </tr>
        </thead>
        <tbody>
            <c:if test="${empty devices}">
                <tr>
                    <td colspan="4" align="center">                             
                         Nenhum dispositivo encontrado</td>
                </tr>
            </c:if>

        </tbody>
        <tbody id="tableholder" class="classholder">
        <c:forEach var="device" items="${devices}">
            <tr>
                <td><a href="<c:url value="/device/update/${device.id}"/>">${device.name}</a></td>
                <td><a href="<c:url value="/device/update/${device.id}"/>">${device.code}</a></td>
                <td><a href="<c:url value="/comandos/${device.id}"/>"><img src="${ctx}/images/comandos.png" alt="Comandos" title="Comandos"></a></td>
                <td><a id="${device.id}" class="delete" href="#"><input type="submit" id="excluir_button" value="" title="Excluir" /></a></td>
            </tr>
        </c:forEach>
        </tbody>
    </table>

</body>
</html>

and here is my JavaScript

jQuery(document).ready(function () {
    jQuery("#table_id").dataTable(); 
});
4

1 回答 1

1

DataTables不支持多个<tbody>-tags。此外,您的第一个<tbody>仅包含一个跨越四个的列,与<thead>-section 不匹配,因此 DataTables 无法初始化。DataTables 不理解 colspanning。

另外,为什么同时jquery.dataTables.min.js jquery.dataTables.js

于 2013-05-13T13:56:16.140 回答