iDisplayLength is not changing in pipeline

iDisplayLength is not changing in pipeline

raju.softagzraju.softagz Posts: 6Questions: 0Answers: 0
edited November 2010 in General
This is too great tool
but I am facing some problem
I have added http://datatables.net/examples/server_side/pipeline.html to my site

My PHP process file have limit condition like
$sLimit = "";
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
{
$sLimit = " LIMIT ". php_db_input( $_GET['iDisplayStart'] ).", ".
php_db_input( $_GET['iDisplayLength'] );
}

On defualt is show 0, 500
my total records are 5,230 total entries

But the navigation is showing - "Showing 1 to 100 of 500 entries (filtered from 5,230 total entries)"

when i click on page navigation on last page 5 , it disables my next option.

i think on last page the iDisplayLength is not increasing automatically..

Please help me

Replies

  • raju.softagzraju.softagz Posts: 6Questions: 0Answers: 0
    My JS code is
    [code]
    var oCache = {
    iCacheLower: -1
    };

    function fnSetKey( aoData, sKey, mValue )
    {
    for ( var i=0, iLen=aoData.length ; i
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I would guess that iTotalRecords and iTotalDisplayRecords ( http://datatables.net/usage/server-side ) are not correct in the return. With no filter applied they should both be equal and 5230 in this case.

    Allan
  • raju.softagzraju.softagz Posts: 6Questions: 0Answers: 0
    edited November 2010
    Hi Allan ,
    My Ajax request on first time without any filter apply is
    http://softagz.example.com/intranet/get_user_data.php?sEcho=1&iColumns=6&sColumns=&iDisplayStart=400&iDisplayLength=500&sNames=%2C%2C%2C%2C%2C&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&sSearch_2=&bRegex_2=false&bSearchable_2=true&sSearch_3=&bRegex_3=false&bSearchable_3=true&sSearch_4=&bRegex_4=false&bSearchable_4=true&sSearch_5=&bRegex_5=false&bSearchable_5=false&iSortingCols=1&iSortCol_0=0&sSortDir_0=desc&bSortable_0=true&bSortable_1=true&bSortable_2=true&bSortable_3=true&bSortable_4=true&bSortable_5=false

    I think iDisplayLength=500 , i have put iDisplayLength=500000 to my js code but i have not reflected..

    on last page, (Page 5). it disables the next button , but when i refresh whole page it increase some more button.
  • raju.softagzraju.softagz Posts: 6Questions: 0Answers: 0
    My first time (Default / without filter) query have lime = limit 0,500
    so the
    iTotalRecords = 5230
    iTotalDisplayRecords = 500

    So iTotalRecords and iTotalDisplayRecords will never same
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Okay that's good as we've got the the cause of the issue. As I noted iTotalRecords and iTotalDisplayRecords must be the same unless there is a filter applied. As the documentation notes:

    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)

    If DataTables wanted to know how many rows you are returned it would just do an Array.length on the return (which it does in fact). So it needs to know how many rows are not returned (i.e. not on the current page).

    Allan
  • raju.softagzraju.softagz Posts: 6Questions: 0Answers: 0
    Hi Allan,
    Sorry for asking one more time, but i am not understanding the situation.

    I have used queries same like your example..

    i want to send to process page.

    Because first time, i am getting iDisplayLength=500 so the records query have limeit 0, 500 and only showing the 500 records. The total number of records doesn't have limit , so it gives the total records.

    I want to change the records on first page or on default page (iDisplayLength=) or change on last page (Page 5 )

    what i do for now ?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Have a look at the JSON that is coming back in this example: http://datatables.net/examples/server_side/pipeline.html . You will see that iTotalRecords and iTotalDisplayRecords are the same.

    If you have 5230 rows in your table, then on the initial draw you want:

    iTotalRecords = 5230
    iTotalDisplayRecords = 5230

    i.e. count the number of rows before the filter gives you iTotalDisplayRecords. And then count hte number of rows after the filter gives you iTotalRecords. If no filter is applied, then they are equal, and the same as the number of rows in your database table.

    Allan
  • raju.softagzraju.softagz Posts: 6Questions: 0Answers: 0
    Hi Allan

    Thanks for help and for your valuable time

    I have got my mistake .. in the process file.
    I havent add the SQL_CALC_FOUND_ROWS , so i am not getting proper result

    bye
This discussion has been closed.