How to load large data on databases into jquery datatables?
$(document).ready(function(){
$('#datatables').dataTable({
"sPaginationType":"full_numbers",
"aaSorting": [[0, 'asc'], [1, 'desc']],
"sScrollY": "200px",
"bJQueryUI":true
});
})
total data on xnod_kode table > 10000 records ???
<?php
$result = mysql_query("SELECT * FROM xnod_kode limit 10");
$no = 1;
while ($row = mysql_fetch_array($result)) {
?>
<tr>
<td><?php echo $no; ?></td>
<td><?php echo $row['kodepos']?></td>
<td><?php echo $row['kelurahan']?></td>
<td><?php echo $row['kecamatan']?></td>
</tr>
<?php
$no++;
}
?>
In general, DataTables handles very large amounts of data best by paginating and fetching data via AJAX: http://datatables.net/examples/data_sources.
If your data varies, and >100,000 records is more of an outlier condition, you may consider using the DataTables scroller plugin: http://datatables.net/extras/scroller/. This creates a far superior user experience and can handle tens of thousands of rows under the right conditions. For optimal performance you'd probably want to remove your default sort from the script and place it in your PHP.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With