Actuellement je génère le tableau de base avec PHPObtenir le contenu de datatables via ajax
<table id="list" class="display">
<thead>
<tr id="hdr">
<th><input type="checkbox" id="check_all"/> ID</th>
<th>Ref. No</th>
<th>Color</th>
<th>Size</th>
<th>Quantity</th>
<th>Stack NO</th>
<th>Price</th>
<th>Add Date</th>
</tr>
</thead>
<tbody>
<?php
$result = $db->query("SELECT * FROM `items` ORDER BY id DESC");
if ($result->num_rows > 0) {
while ($row = $result->fetch_object()) {
echo '<tr url="?page=item&id=' . $row->id . '">
<td class="item_id"><input type="checkbox" name="checkbox[]" method="post" value="' . $row->id . '" class="checkbox"/> ' . $row->id . '</td>
<td> ' . $row->refno . '</td>
<td style="text-align:center">' . $row->color . '</td>
<td style="text-align:center">' . $row->size . '</td>
<td style="text-align:center" id="qt">' . trim($row->qt) . '</td>
<td style="text-align:center">' . $row->stackno . '</td>
<td style="text-align:center">' . $row->price . '</td>
<td>' . date('d.m.Y', strtotime($row->add_date)) . '</td>
</tr>';
}
}
?>
</tbody>
</table>
appliquant ensuite datatables dans ce genre
oTable= $('#list').dataTable({
"bJQueryUI": true,
"iDisplayLength": 25,
"aaSorting": [],
"aoColumns": [
{
"bSortable": false
},
null, null, null,null,null, null, null
]
}).columnFilter({
sPlaceHolder: "head:before",
aoColumns: [ null, null, null,null,null, null, null,
{
type: "date-range"
}
]
});
Il y a très gros problème:
Actuellement, mon la table a environ 2000 lignes. Il faut très longtemps pour générer et charger toute la table. (Au début, il génère ensuite des données de base applieas) Comment puis-je modifier ce script pour obtenir du contenu via ajax page par page?
D'accord; tous les exemples sont là. Mon premier projet avec DataTables utilisé côté serveur et je ne l'ai jamais considéré comme caché; Je l'ai cherché et il était là: http://datatables.net/usage/server-side –