DataTables logo DataTables

via Ad Packs
Filtered from Value Greater than Total Number of Entries
  • 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.
  • 5 Comments sorted by
  • 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
  • We are using server-side processing. Here is the JSON response:

    {"iTotalRecords":24,"iTotalDisplayRecords":24,"sEcho":null,"aaData":[["<a href=\"facilityFullDetails.php?facID=22\" target=\"_blank\">Batman Residence<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6453\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-23<\/a>","Designated Operator"],["<a href=\"facilityFullDetails.php?facID=173\" target=\"_blank\">Greenbriar Extended Stay - 600<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6454\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-23<\/a>","Designated Operator"],["<a href=\"facilityFullDetails.php?facID=173\" target=\"_blank\">Greenbriar Extended Stay - 600<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6459\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-23<\/a>","AMC"],["<a href=\"facilityFullDetails.php?facID=174\" target=\"_blank\">Greenbriar Extended Stay - 620<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6455\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-23<\/a>","Designated Operator"],["<a href=\"facilityFullDetails.php?facID=99\" target=\"_blank\">FuelStop<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6458\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-20<\/a>","Designated Operator"],["<a href=\"facilityFullDetails.php?facID=50\" target=\"_blank\">Cooltown Gas #2<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6456\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-20<\/a>","Designated Operator"],["<a href=\"facilityFullDetails.php?facID=64\" target=\"_blank\">Busco - Santa Rosa<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6431\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-18<\/a>","Designated Operator"],["<a href=\"facilityFullDetails.php?facID=49\" target=\"_blank\">Help Is On The Way<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6432\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-18<\/a>","Designated Operator"],["<a href=\"facilityFullDetails.php?facID=48\" target=\"_blank\">Cooltown Gas<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6434\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-18<\/a>","Designated Operator"],["<a href=\"facilityFullDetails.php?facID=297\" target=\"_blank\">VNC Containment<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6451\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-21<\/a>","Spill Bucket Test"],["<a href=\"facilityFullDetails.php?facID=297\" target=\"_blank\">VNC Containment<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6450\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-21<\/a>","AMC"],["<a href=\"facilityFullDetails.php?facID=187\" target=\"_blank\">Stevers Towers<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6448\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-20<\/a>","Spill Bucket Test"],["<a href=\"facilityFullDetails.php?facID=187\" target=\"_blank\">Stevers Towers<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6449\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-20<\/a>","AMC"],["<a href=\"facilityFullDetails.php?facID=353\" target=\"_blank\">Jolly Rent A Car - Sacramento<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6447\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-19<\/a>","Spill Bucket Test"],["<a href=\"facilityFullDetails.php?facID=353\" target=\"_blank\">Jolly Rent A Car - Sacramento<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6446\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-19<\/a>","AMC"],["<a href=\"facilityFullDetails.php?facID=354\" target=\"_blank\">Fancy Rent A Car - Sacramento<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6445\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-19<\/a>","Spill Bucket Test"],["<a href=\"facilityFullDetails.php?facID=354\" target=\"_blank\">Fancy Rent A Car - Sacramento<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6444\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-19<\/a>","AMC"],["<a href=\"facilityFullDetails.php?facID=300\" target=\"_blank\">LowCost Rentals<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6424\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-17<\/a>","Spill Bucket Test"],["<a href=\"facilityFullDetails.php?facID=300\" target=\"_blank\">LowCost Rentals<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6421\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-17<\/a>","AMC"],["<a href=\"facilityFullDetails.php?facID=368\" target=\"_blank\">Jolly Rent A Car - SFO<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6425\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-17<\/a>","Spill Bucket Test"],["<a href=\"facilityFullDetails.php?facID=368\" target=\"_blank\">Jolly Rent A Car - SFO<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6426\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-17<\/a>","AMC"],["<a href=\"facilityFullDetails.php?facID=391\" target=\"_blank\">Stanley Rent a Car - San Francisco<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6428\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-17<\/a>","Spill Bucket Test"],["<a href=\"facilityFullDetails.php?facID=391\" target=\"_blank\">Stanley Rent a Car - San Francisco<\/a>","<a href=\"Compliance_Testing_Center.php?systemTestID=6427\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-17<\/a>","AMC"],["<a href=\"facilityFullDetails.php?facID=391\" target=\"_blank\">Stanley Rent a Car - San Francisco<\/a>","<a href=\"PDFUpload\/391\/ST38%20-%20AVIS%20-%20SAN%20FRANCISCO%20-%20AST.pdf\" target=\"_blank\" title=\"View Uploaded PDF\">2012-01-17<\/a>&nbsp;<a href=\"uploadPDF.php?fn=PDFUpload\/391\/ST38%20-%20AVIS%20-%20SAN%20FRANCISCO%20-%20AST.pdf\"><img src=\"images\/icons\/edit_icon.png\" title=\"Edit PDF Details\"><\/a><a href=\"javascript:deletionConfirm('PDFUpload\/391\/ST38%20-%20AVIS%20-%20SAN%20FRANCISCO%20-%20AST.pdf');\"><img src=\"images\/icons\/delete_icon.png\" title=\"Delete File\" name=\"deletePDF\" id=\"deletePDF\"><\/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
  • Not sure if anyone else has experienced this, but want to bump this one time.

    Thanks.
  • Maybe the problem resides in the next lines of the php file:
    <?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];
    ?>


    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.
  • "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.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Support

Get useful and friendly help straight from the source.

In this Discussion