Not all rows from the table are being displayed
Not all rows from the table are being displayed
homerjsimpson
Posts: 8Questions: 0Answers: 0
I hope someone can help me with the following problem:
For some reason the tabel only reads the first ten rows of the datatable allthough it has a lot more rows. Below are the bits of code I use to make the datatable. Some help would be very much apreciated.
[code]oTable = $('#boeken_table').dataTable
(
{
"bJQueryUI" : true,
"aoColumns" : [
{ "sTitle": "Leerling nummer", "sWidth": "10%" },
{ "sType": "string", "sTitle": "Naam"},
{ "sType": "string", "sTitle": "Boek nummer", "sWidth": "10%" },
{ "sType": "string", "sTitle": "ISBN", "sWidth": "10%" },
{ "sType": "string", "sTitle": "Titel", "sWidth": "25%" },
{ "sType": "string", "sTitle": "Aantal", "sWidth": "10%" },
{ "sType": "date", "sTitle": "Datum geleverd", "sWidth": "14%" },
{ "sType": "string", "sTitle": "Richting", "sWidth": "10%" },
{ "sType": "string", "sTitle": "Klas", "sWidth": "10%" }
],
"oLanguage" : {
"sInfo": "_START_ tot _END_ van _TOTAL_ resultaten",
"sZeroRecords": "Geen leveringen in deze periode",
"sInfoFiltered": "(gefilterd uit een totaal van _MAX_)",
"sLengthMenu": 'Weergeven per '+
'5'+
'10'+
'20'+
'50'+
' resultaten'
},
"iDisplayLength" : 10,
"bStateSave": false,
"aaSorting": [[6,'asc']],
'bServerSide' : false,
"bProcessing" : true,
"fnInitComplete": function() {
$("#boeken_table_filter input").focus();
},
'sAjaxSource' : siteurl + "sis/index.php/main/listener_leveringenlijst",
'fnServerData': function(sSource, aoData, fnCallback)
{
$.ajax
({
'dataType': 'json',
'type' : 'POST',
'url' : sSource,
'data' : aoData,
'success' : fnCallback
});
}
});
[/code]
The sAjaxsource bit:
[code]
public function listener_leveringenlijst()
{
$table = "Digifact";
$columns = array( 'leerlingnummer', 'naam', 'boeknummer', 'isbn', 'titel','aantal', 'datum', 'richting', 'jaar');
$index = "datum";
$str = $this->datatablesdoc->generate($table, $columns, $index);
echo($str);
}[/code]
For some reason the tabel only reads the first ten rows of the datatable allthough it has a lot more rows. Below are the bits of code I use to make the datatable. Some help would be very much apreciated.
[code]oTable = $('#boeken_table').dataTable
(
{
"bJQueryUI" : true,
"aoColumns" : [
{ "sTitle": "Leerling nummer", "sWidth": "10%" },
{ "sType": "string", "sTitle": "Naam"},
{ "sType": "string", "sTitle": "Boek nummer", "sWidth": "10%" },
{ "sType": "string", "sTitle": "ISBN", "sWidth": "10%" },
{ "sType": "string", "sTitle": "Titel", "sWidth": "25%" },
{ "sType": "string", "sTitle": "Aantal", "sWidth": "10%" },
{ "sType": "date", "sTitle": "Datum geleverd", "sWidth": "14%" },
{ "sType": "string", "sTitle": "Richting", "sWidth": "10%" },
{ "sType": "string", "sTitle": "Klas", "sWidth": "10%" }
],
"oLanguage" : {
"sInfo": "_START_ tot _END_ van _TOTAL_ resultaten",
"sZeroRecords": "Geen leveringen in deze periode",
"sInfoFiltered": "(gefilterd uit een totaal van _MAX_)",
"sLengthMenu": 'Weergeven per '+
'5'+
'10'+
'20'+
'50'+
' resultaten'
},
"iDisplayLength" : 10,
"bStateSave": false,
"aaSorting": [[6,'asc']],
'bServerSide' : false,
"bProcessing" : true,
"fnInitComplete": function() {
$("#boeken_table_filter input").focus();
},
'sAjaxSource' : siteurl + "sis/index.php/main/listener_leveringenlijst",
'fnServerData': function(sSource, aoData, fnCallback)
{
$.ajax
({
'dataType': 'json',
'type' : 'POST',
'url' : sSource,
'data' : aoData,
'success' : fnCallback
});
}
});
[/code]
The sAjaxsource bit:
[code]
public function listener_leveringenlijst()
{
$table = "Digifact";
$columns = array( 'leerlingnummer', 'naam', 'boeknummer', 'isbn', 'titel','aantal', 'datum', 'richting', 'jaar');
$index = "datum";
$str = $this->datatablesdoc->generate($table, $columns, $index);
echo($str);
}[/code]
This discussion has been closed.
Replies
[code] if ($this->ci->input->post("iDisplayStart") && $this->ci->input->post("iDisplayLength") != "-1")
$sLimit .= $this->ci->input->post("iDisplayStart") . ", " . $this->ci->input->post("iDisplayLength");
else {
$iDisplayLength = $this->ci->input->post("iDisplayLength");
if (empty($iDisplayLength))
$sLimit .= "0,10";
else
$sLimit .= "0," . $iDisplayLength;
}
[/code]
If I change the 10 above in a higher number the tabel will read more rows. But how must this be done properly without knowing how much rows there will be in the database ?