Filtered from Value Greater than Total Number of Entries

Filtered from Value Greater than Total Number of Entries

NathanSFNathanSF Posts: 17Questions: 0Answers: 0
edited January 2012 in General
I'm getting the following text in the footer for one of my tables when no search filtering is applied: "Showing 1 to 25 of 39 entries (filtered from 26 total entries)"

Then when I apply a filter I get the following: "Showing 1 to 16 of 16 entries"

A few oddities:
1. Not sure why footer is showing 'filtered from' when no search filter is applied, and the text is not showing when there is a search filter being applied. This is the opposite of how the search filter is working in my other tables.
2. How could the total entries be 39, while the 'filtered from total entries' is only 26. Seems the 'filtered from' should be equal to greater than the number of entries displayed.

Any info on this appreciated.

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Are you using server-side processing? If so, what does your JSON response look like. If not, can you give me a link please?

    Thanks,
    Allan
  • NathanSFNathanSF Posts: 17Questions: 0Answers: 0
    edited January 2012
    We are using server-side processing. Here is the JSON response:

    {"iTotalRecords":24,"iTotalDisplayRecords":24,"sEcho":null,"aaData":[["Batman Residence<\/a>","2012-01-23<\/a>","Designated Operator"],["Greenbriar Extended Stay - 600<\/a>","2012-01-23<\/a>","Designated Operator"],["Greenbriar Extended Stay - 600<\/a>","2012-01-23<\/a>","AMC"],["Greenbriar Extended Stay - 620<\/a>","2012-01-23<\/a>","Designated Operator"],["FuelStop<\/a>","2012-01-20<\/a>","Designated Operator"],["Cooltown Gas #2<\/a>","2012-01-20<\/a>","Designated Operator"],["Busco - Santa Rosa<\/a>","2012-01-18<\/a>","Designated Operator"],["Help Is On The Way<\/a>","2012-01-18<\/a>","Designated Operator"],["Cooltown Gas<\/a>","2012-01-18<\/a>","Designated Operator"],["VNC Containment<\/a>","2012-01-21<\/a>","Spill Bucket Test"],["VNC Containment<\/a>","2012-01-21<\/a>","AMC"],["Stevers Towers<\/a>","2012-01-20<\/a>","Spill Bucket Test"],["Stevers Towers<\/a>","2012-01-20<\/a>","AMC"],["Jolly Rent A Car - Sacramento<\/a>","2012-01-19<\/a>","Spill Bucket Test"],["Jolly Rent A Car - Sacramento<\/a>","2012-01-19<\/a>","AMC"],["Fancy Rent A Car - Sacramento<\/a>","2012-01-19<\/a>","Spill Bucket Test"],["Fancy Rent A Car - Sacramento<\/a>","2012-01-19<\/a>","AMC"],["LowCost Rentals<\/a>","2012-01-17<\/a>","Spill Bucket Test"],["LowCost Rentals<\/a>","2012-01-17<\/a>","AMC"],["Jolly Rent A Car - SFO<\/a>","2012-01-17<\/a>","Spill Bucket Test"],["Jolly Rent A Car - SFO<\/a>","2012-01-17<\/a>","AMC"],["Stanley Rent a Car - San Francisco<\/a>","2012-01-17<\/a>","Spill Bucket Test"],["Stanley Rent a Car - San Francisco<\/a>","2012-01-17<\/a>","AMC"],["Stanley Rent a Car - San Francisco<\/a>","2012-01-17<\/a> <\/a><\/a>","BAAQMD Report #38"]]}

    The footer text for this JSON is "Showing 1 to 10 of 24 entries (filtered from 11 total entries)". Again, no filter applied.

    var dTablereportTable;

    $(document).ready(function() {


    // Note: to redraw the table after editing content use dTablereportTable.fnDraw(false)

    dTablereportTable = $('#reportTable').dataTable({

    "bProcessing": true,
    "bJQueryUI": true,
    "sDom": '<"clear"><"top ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"lTf>rt<"bottom ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"pi><"clear">',
    "bAutoWidth": true,

    "sAjaxSource": 'json_test_events.php?showDash=1',

    "bStateSave": true,
    "oTableTools": {
    "sSwfPath": "js/swf/copy_cvs_xls_pdf.swf",
    "aButtons": [
    "copy",
    {
    "sExtends": "collection",
    "sButtonText": "Save",
    "aButtons": [ "csv", "xls", "pdf" ]
    }
    ]
    },

    "aaSorting": [[1,"desc"],[0,"desc"]],
    "sPaginationType": "two_button",
    "bServerSide": true,

    "sScrollX": "100%",
    "sScrollXInner": "100%"

    });
    // $(window).bind('resize', function () {
    // dTablereportTable.fnAdjustColumnSizing();
    // });

    });


    Please let me know if you'd like more info.
    Nathan
  • NathanSFNathanSF Posts: 17Questions: 0Answers: 0
    Not sure if anyone else has experienced this, but want to bump this one time.

    Thanks.
  • MariosMarios Posts: 4Questions: 0Answers: 0
    edited January 2012
    Maybe the problem resides in the next lines of the php file:
    [code]<?php
    /* Data set length after filtering */
    $sQuery = "
    SELECT FOUND_ROWS()
    ";
    $rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
    $aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
    $iFilteredTotal = $aResultFilterTotal[0];

    /* Total data set length */
    $sQuery = "
    SELECT COUNT(".$sIndexColumn.")
    FROM $sTable
    ";
    $rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
    $aResultTotal = mysql_fetch_array($rResultTotal);
    $iTotal = $aResultTotal[0];
    ?>[/code]

    I think that the sEcho from JSON response must not be null. I don't sure if the variable showDash=1 can be send in this way. I think that using the "Add extra HTTP variables" from the example page may work for this.
    Sorry for my english.
  • NathanSFNathanSF Posts: 17Questions: 0Answers: 0
    "I think that the sEcho from JSON response must not be null. I don't sure if the variable showDash=1 can be send in this way. I think that using the "Add extra HTTP variables" from the example page may work for this."

    Thanks for your input. We are now experiencing this issue with other Datatables on our site, ones without the extra HTTP variables. "Showing 1 to 10 of 77 entries (filtered from 20 total entries)" Getting that message for table with server side processing with no variables sent via the URL.
This discussion has been closed.