why i got (filtered from X total entries) in the footer

why i got (filtered from X total entries) in the footer

espresso74espresso74 Posts: 11Questions: 0Answers: 0
edited January 2010 in General
hey guys,

Just implemented datatable plug in, and made it working on my Asp.net. It is brilliant tool to use.
however, i wonder why i got '(filtered from 12 total entries) ' in the footer part(see the below), what does 'filtered' stand for?. and the Next, Previous Button does not work at all. any ideas or which part i have done is wrong?
how can i get ride of this unnecessary incorrect and annoying footer?


--Footer (first page)---------------
Showing 1 to 10 of 10 entries
(filtered from 12 total entries)


thanks
dave

Replies

  • espresso74espresso74 Posts: 11Questions: 0Answers: 0
    the funny thing is, after i applied the Server-Code pipeline (from the example), it automatically fixed all the issues (preview, next button working, the footer display correctly, etc), it is amazing, isnt it?
    any idea with that? :-)

    thanks
    dave
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi Dave,

    "Filtered" means that there is a search parameter being used - or possibly more likely here iTotalRecords and iTotalDisplayRecords aren't being returned correctly from the server: http://datatables.net/usage/server-side . If there is no filter then they should both be the same. http://datatables.net/examples/data_sources/server_side.html

    Regards,
    Allan
  • Spike00Spike00 Posts: 5Questions: 0Answers: 0
    Hi Allan, I'm in similar situation, besides I'm using php and I just used the code in the example, modifying the queries according to my needs, but maybe I made something wrong.

    I too have the 'filtered' issue when there should not be filter applied.

    Executing the php file alone, I see this at the beginning of the printed output:

    [code]
    {"sEcho": 0, "iTotalRecords": 1987, "iTotalDisplayRecords": 1987, "aaData": [
    [/code]

    So, unless I must check these values somewhere else in the code, they seems to be right, but in my table I have

    Showing 1 to 10 of 10 entries (filtered from 1987 total entries)

    And of course, Next button is disabled.

    Unfortunately I cannot show this online.

    Here is a bit of my code. Hmm I must bring your attention to one particular thing:

    My query uses more tables and joins on them and more important, I need to use my own WHERE clause, so I saw that the code how I copied from the example has a problem, since your WHERE clause (that is 'activated when there's a search (and / or maybe a filter too) contains 'WHERE' but of course I already have it in my query, so I simply modified the code.

    The code in next post, because of characters limit

    Have you any idea?

    Thanks in advance, Paolo
  • Spike00Spike00 Posts: 5Questions: 0Answers: 0
    [code]
    $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
    die( 'Could not open connection to server' );

    mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
    die( 'Could not select database '. $gaSql['db'] );

    /* Paging */
    $sLimit = "";
    if ( isset( $_GET['iDisplayStart'] ) )
    {
    $sLimit = "LIMIT ".mysql_real_escape_string( $_GET['iDisplayStart'] ).", ".
    mysql_real_escape_string( $_GET['iDisplayLength'] );
    }

    /* Ordering */
    if ( isset( $_GET['iSortCol_0'] ) )
    {
    $sOrder = "ORDER BY ";
    for ( $i=0 ; $i
  • Spike00Spike00 Posts: 5Questions: 0Answers: 0
    Hmmm...

    Inside the js file, into function _fnAjaxUpdateDraw, I put an alert:

    [code]alert(json.iTotalRecords + " " + json.iTotalDisplayRecords);[/code]

    and yes, these values are different: 1987 and 10

    Did you refer to these values?

    If so, any hint on what to do?
  • Spike00Spike00 Posts: 5Questions: 0Answers: 0
    I'm an idiot!

    In the first sQuery, I didn't saw that there was SQL_CALC_FOUND_ROWS before the id... so I didn't used it.

    Just using it, now it works (quite).

    It hang up on processing around record #50, so there must be something that 'break' the js in one or more of my records.

    Next step I'll try to understand what may be.
  • Spike00Spike00 Posts: 5Questions: 0Answers: 0
    Now everything works.

    I had stupid problems with columns names, sorted out thanks to firebug and grabbing the url created and launching that url and seeing which error it printed out.

    But I found a thing in your example code that didn't worked for me.

    addslashes applied to fields values retrieved from the db and used to populate the table wasn't enough for my records. I had to use htmlentities instead.

    Now (hmm next time) it's time to play with jedit.
This discussion has been closed.