I get an empty row for each object from a db, why?
I get an empty row for each object from a db, why?
![papanito](https://secure.gravatar.com/avatar/f2d9d8c82942bdb83782c9e88c1181a2/?default=https%3A%2F%2Fvanillicon.com%2Ff2d9d8c82942bdb83782c9e88c1181a2_200.png&rating=g&size=120)
Link to test case: N/A
Debugger code (debug.datatables.net): N/A
Error messages shown:
DataTables warning: table id=usersTable - Requested unknown parameter '0' for row 1, column 0. For more information about this error, please see https://datatables.net/tn/4
Description of problem:
When loading the page the data is ok
After clicking "OK I see this
<link rel="stylesheet" href="https://cdn.datatables.net/2.2.1/css/dataTables.dataTables.css" />
<script src="https://code.jquery.com/jquery-3.7.1.js"
integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/2.2.1/js/dataTables.js"></script>
<script>
$(document).ready(function() {
$('#usersTable').DataTable({
paging: true,
ordering: true,
searchable: true,
});
});
</script>
</head>
<body>
<h1>Users</h1>
<table id="usersTable" border="1" class="hover order-column" data-order='[[ 1, "asc" ]]' data-page-length=10>
<thead>
<tr>
<th>ID</th>
<th>Username</th>
<th>Name</th>
<th>Surname</th>
<th>Save</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr data-user-id="{{ user[0] }}">
<td data-column="id">{{ user[0] }}</td>
<td class="editable" data-column="username">{{ user[1] }}</td>
<td class="editable" data-column="name">{{ user[2] }}</td>
<td class="editable" data-column="surname">{{ user[3] }}</td>
<td><button class="save-btn">Save</button></td>
<tr>
{% endfor %}
</tbody>
</table>
This question has an accepted answers - jump to answer
Answers
My guess is on line 36 you have
<tr>
but should have a closing tag of</tr>
.If this doesn't help then please provide a test case showing the issue. Possibly inspect the
table
tag with the browser's inspector tool and copy the generated HTML into a test case here:https://live.datatables.net/
Kevin
Thanks for the hint