Datatables works not as aspected

Datatables works not as aspected

johanjajohanja Posts: 2Questions: 0Answers: 0
edited May 2012 in DataTables 1.9
I followed the step by step instructions and data shows nicely on screen. But when i click on the column headers to adapt sorting nothing happens, also the arrows are not shown.
Pagination also doesn't work. Used default css.

Tried it in Firefox, safari, chrome on OSX, Mamp

Firebug doesn't give any errors...
How can I check/fix this?

Replies

  • drchanixdrchanix Posts: 20Questions: 0Answers: 0
    It would be great if you could at least put your codes so that we can see and help in the solving the problem.
    For the arrows that are not shown, that means that the images are not found. Use firebug and inspect the element containing the arrows and see if the images are loaded.
  • johanjajohanja Posts: 2Questions: 0Answers: 0
    This is the code:

    [code]
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.DTD">





    @import "/DataTables-1.9.1/media/css/demo_table.css";

    <!-- !-->




    $(document).ready(function(){
    // activeer table formatting
    $('#table_id').dataTable();
    $("#zone-bar li em").click(function() {
    // var hidden = $(this).parents("li").children("ul").is(":hidden");

    $("#zone-bar>ul>li>ul").hide()
    $(this).parents("li").children("ul").show();
    });

    });
    function Toonklanten(data){
    Object=document.getElementById("Klantenoverzicht");
    Object.innerHTML=data;
    }








    Gebruiker: 
    Nieuwe gebruiker 
    Afmelden 

    Zoeken









    Navigatie  





    Klanten
    Leveranciers








    ©2012 IT-Factory bvba




    [/code]

    klanten.php file:

    [code]
    <?php
    //$q=$_GET["q"];
    // Globale variabelen
    $db_host = 'localhost';
    $db_name = '';
    $db_user = '';
    $db_pw = '';
    $con = mysql_connect('localhost',$db_user,$db_pw);
    if (!$con) {
    die('Probleem met database verbinding! (klanten.php): ' . mysql_error());
    }
    mysql_select_db($db_name,$con);
    //$query="SELECT * FROM Klanten LEFT JOIN [Postcode Plaatsnaam] ON Klanten.klantpostcode = [Postcode Plaatsnaam].ID";
    $query="SELECT * FROM Klanten";
    $result = mysql_query($query);
    echo "



    Naam
    Adres
    Postcode
    Plaats
    Telefoon
    Fax
    Contact
    BTW-nummer
    PrijsCat.
    DropKost
    VarKost
    TransKost
    Korting
    IC


    ";
    while ($row = mysql_fetch_array($result)) {
    echo "";
    echo "" . $row['KlantNaam'] . "";
    echo "" . $row['KlantAdres'] . "";
    echo "" . $row['KlantPostcode'] . "";
    echo "" . $row['KlantTelefoon'] . "";
    echo "" . $row['KlantFax'] . "";
    echo "" . $row['KlantContactPersoon'] . "";
    echo "" . $row['KlantBTW'] . "";
    echo "" . $row['KlantPrijsCategorie'] . "";
    echo "" . $row['KlantDropkost'] . "";
    echo "" . $row['KlantVarKost'] . "";
    echo "" . $row['KlantTransportKost'] . "";
    echo "" . $row['KlantGebruikKortingSchema'] . "";
    echo "" . $row['KlantIC'] . "";
    echo "";
    }
    echo "

    ";
    mysql_close($con);
    ?>

    [/code]
  • allanallan Posts: 61,822Questions: 1Answers: 10,127 Site admin
    At a guess I'd say that you are running DataTables before you load the HTML table by Ajax - so DataTables is not running on your table (since it doesn't yet exist). You want to run DataTables on the table in the Ajax success callback. You can confirm how many tables are DataTables tables on your page using the debugger: http://debug.datatables.net .

    Allan
This discussion has been closed.