Table load already filtered (server side)
Table load already filtered (server side)
Hi,
why on load my table... its already filtered?
Showing 1 to 30 of 30 entries (filtered from 2,049 total entries)
and just its showing 30 rows, isnt paginating...
[code]
"bServerSide": true,
"sAjaxSource": "estoque.produtos.ajax.php",
"aaSorting": [[ 1, "asc" ]],
"aoColumnDefs": [ //This identifies column data types to aid sorting.
{"sTitle": "#", "sName": "#", "aTargets": [ 0 ], "bSortable" : false },
{"sTitle": "COD", "sName": "CODIGO", "aTargets": [ 1 ] },
{"sTitle": "DESCRICAO", "sName": "DESCRICAO", "aTargets": [ 2 ] },
{"sTitle": "MARCA", "sName": "CODMARCA", "aTargets": [ 3 ] } ,
{"sTitle": "REF", "sName": "REFERENCIA", "aTargets": [ 4 ] } ,
{"sTitle": "PREÇO VISTA", "sName": "PRECOVENDA", "aTargets": [ 5 ] } ,
{"sTitle": "PREÇO PRAZO", "sName": "PRECOPRAZO", "aTargets": [ 6 ] } ,
{"sTitle": "ESTOQUE DISP.", "sName": "QTDE", "aTargets": [ 7 ], "bSortable" : false }
],
"bDeferRender": true,
"bProcessing": true,
"bInfo": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"iDisplayLength": 30,
"bInfo": true,
"bAutoWidth": true
[code]
why on load my table... its already filtered?
Showing 1 to 30 of 30 entries (filtered from 2,049 total entries)
and just its showing 30 rows, isnt paginating...
[code]
"bServerSide": true,
"sAjaxSource": "estoque.produtos.ajax.php",
"aaSorting": [[ 1, "asc" ]],
"aoColumnDefs": [ //This identifies column data types to aid sorting.
{"sTitle": "#", "sName": "#", "aTargets": [ 0 ], "bSortable" : false },
{"sTitle": "COD", "sName": "CODIGO", "aTargets": [ 1 ] },
{"sTitle": "DESCRICAO", "sName": "DESCRICAO", "aTargets": [ 2 ] },
{"sTitle": "MARCA", "sName": "CODMARCA", "aTargets": [ 3 ] } ,
{"sTitle": "REF", "sName": "REFERENCIA", "aTargets": [ 4 ] } ,
{"sTitle": "PREÇO VISTA", "sName": "PRECOVENDA", "aTargets": [ 5 ] } ,
{"sTitle": "PREÇO PRAZO", "sName": "PRECOPRAZO", "aTargets": [ 6 ] } ,
{"sTitle": "ESTOQUE DISP.", "sName": "QTDE", "aTargets": [ 7 ], "bSortable" : false }
],
"bDeferRender": true,
"bProcessing": true,
"bInfo": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"iDisplayLength": 30,
"bInfo": true,
"bAutoWidth": true
[code]
This discussion has been closed.
Replies
(and "Showing 1 to 30 of 30 entries" means there's nothing to paginate).
Allan
on estoque.produtos.ajax.php
its returning:
sEcho":1
"iTotalRecords":2051
"iTotalDisplayRecords":30
i'm trying to show 30 rows by page, with this TOTAL it will give me 69 pages.
but isnt paginating...
just appears "first / previous PAGE 1 next / last"
on my table initialization i'm starting with 30 rows:
"iDisplayLength": 30,
but why dont paginate if the total is 2051 and i'm loading all the rows?
> iTotalRecords - Total records, before filtering (i.e. the total number of records in the database)
> iTotalDisplayRecords - Total records, after filtering (i.e. the total number of records after filtering has been applied - not just the number of records being returned in this result set)
As I said - you aren't returning one of those parameters correctly - in this case `iDisplayLength` .
Allan
if you are not filtering, then "iTotalDisplayRecords" should have the same value as "iTotalRecords" (i.e. 2051) on the return from Ajax.
"iDisplayLength" is not returned by Ajax.
Your code says you are returning 30 records, that is all that will fit on one page, so no need for paging.
Check your estoque.produtos.ajax.php, it should not need to know the page size.
I've changed the code to sLimite for using Firebird DataBase.
[code]
if(isset($_GET['sSearch']))
{
if($_GET['sSearch']!='' && $_GET['sSearch']!=NULL)
{
if($_GET['sSearch']=='')
{
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
{
$sLimit = "FIRST ".intval( $_GET['iDisplayLength'] )." SKIP ".
intval( $_GET['iDisplayStart'] );
}
}
else
{
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
{
$sLimit = "FIRST ".intval( $_GET['iDisplayLength'] )." SKIP ".
intval( $_GET['iDisplayStart'] );
}
}
}
}
[/code]
and now I have this result on the initialization
iTotalRecords:2051
iTotalDisplayRecords:2051
but the table loads 2051 register and don't paginate...
My only guess at the moment (and its just a guess since I don't have a test link I can check) is that you aren't returning sEcho correctly. It changes on every draw.
Allan