Problem with filtering and displaying issue

Problem with filtering and displaying issue

bitseekerbitseeker Posts: 2Questions: 0Answers: 0
edited May 2013 in DataTables 1.9
Hi there,

this is my first time using DataTables, so my understanding is quite limited right now.

Ok , following:
I do retrieve data from a mysql database using following php code which i copied somewhere from your example sites:

filename: list2.php
[code]
<?php

require_once('inc/config.inc.php');



/*
* Script: DataTables server-side script for PHP and MySQL
* Copyright: 2010 - Allan Jardine
* License: GPL v2 or BSD (3-point)
*/

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Easy set variables
*/

/* Array of database columns which should be read and sent back to DataTables. Use a space where
* you want to insert a non-database field (for example a counter or static image)
*/
$aColumns = array( 'arc_id',
'arc_ort',
'arc_sig_orig',
'arc_akte',
'arc_dokument',
'arc_anhang',
'arc_archiv',
'arc_bestand',
'arc_aktennr',
'arc_betreff',
'arc_zeitraum',
'arc_dokumentname',
'arc_othema',
'arc_uthema',
'arc_art',
'arc_transkript',
'arc_seiten',
'arc_bemerk_extern',
'arc_datum_von',
'arc_datum_bis',
'arc_transskript_inhalt',
'arc_inhalt' );


/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "arc_id";

/* DB table to use */
$sTable = "archiv";

/* Database connection information */
$gaSql['user'] = $user;
$gaSql['password'] = $pass;
$gaSql['db'] = $dbn;
$gaSql['server'] = $host;


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
* no need to edit below this line
*/

/*
* MySQL connection
*/
$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'] ) && $_GET['iDisplayLength'] != '-1' )
{
$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 $iFilteredTotal,
"aaData" => array()
);

while ( $aRow = mysql_fetch_array( $rResult ) )
{
$row = array();
for ( $i=0 ; $i
[/code]

Replies

  • bitseekerbitseeker Posts: 2Questions: 0Answers: 0
    Why is part 2 (as a comment - due to length restrictions) not posted?
  • bitseekerbitseeker Posts: 2Questions: 0Answers: 0
    my html looks like this:
    [code]
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


    <?php echo $seo_title; ?>






















    (function($) {
    $.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) {
    // check that we have a column id
    if ( typeof iColumn == "undefined" ) return new Array();

    // by default we only want unique data
    if ( typeof bUnique == "undefined" ) bUnique = true;

    // by default we do want to only look at filtered data
    if ( typeof bFiltered == "undefined" ) bFiltered = true;

    // by default we do not want to include empty values
    if ( typeof bIgnoreEmpty == "undefined" ) bIgnoreEmpty = true;

    // list of rows which we're going to loop through
    var aiRows;

    // use only filtered rows
    if (bFiltered == true) aiRows = oSettings.aiDisplay;
    // use all rows
    else aiRows = oSettings.aiDisplayMaster; // all row numbers

    // set up data array
    var asResultData = new Array();

    for (var i=0,c=aiRows.length; i -1) continue;

    // else push the value onto the result data array
    else asResultData.push(sValue);
    }

    return asResultData;
    }}(jQuery));


    function fnCreateSelect( aData )
    {
    var r='', i, iLen=aData.length;
    for ( i=0 ; i





    ID
    Stadt
    Signatur
    Akte
    Dokument
    Anhang







































































    <?php include('list2.php'); ?>


    <?php include("inc/footer.inc.php"); ?>




    [/code]

    What i should mention: i didn´t change anything in the core files or in the copied code in this two files.


    Now, when you look at the result, there are two this that cause me headache:
    1. Where does the JSON output under the table come from?

    2. Why are the select fields not filled with values?
    As you can see i inserted a "alert (i);" where it iterates thru the tfoot and if i comment it in, it counts from 0 to 5 and the select fields are filled with correct values (well at least from the first ten rows - not from all rows as i would expect). But not more than five. All other tfoot/th don´t get recognized and will not be drawn.
    If i comment out the alert function, all th get recognized, but no values are filled.
    Very strange to me.

    Can anybody gimme a hint?

    thx Oliver
This discussion has been closed.