TableTools can't work

TableTools can't work

lihailihai Posts: 15Questions: 0Answers: 0
edited November 2012 in TableTools
I download DataTables-1.9.4.And I open the demo pages in DataTables-1.9.4\extras\TableTools.All of the buttons can't work on click except the button of print.What the problem?And What shall do to make the buttons work like cope、excel?

Replies

  • allanallan Posts: 61,934Questions: 1Answers: 10,155 Site admin
    1. Please post a link to the page showing the problem.
    2. If you are running from file:// you need to add a Flash security exception - http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

    Allan
  • metzmetz Posts: 2Questions: 0Answers: 0
    I had the same problems to understand why the Examples for TableTools didn't worked as expected. Your answer helped me.Thanks Allan.
    I've forgotten to run it via localserver. At first it was running from file://
  • metzmetz Posts: 2Questions: 0Answers: 0
    I achieved creating tabletools and once i also managed to add ColVis to "Show / Hide" Columns.
    I'd like to know how i could add both to my datatable. By just using the the same code of line in one initialisation of a table, i always end up seeing only the buttons for tabletools. Could someone explain it to me?
  • metzmetz Posts: 2Questions: 0Answers: 0
    After I tried to learn by looking closer at this example, which lihai mentioned, I also still dont know what lines of code I have to add to build a working TableTools Button.

    Could someone explain it to me, by making reference to this code?
    [code]<?php
    //Verbindungsaufbau mit MySQL Datenbank: Bisher noch Standardwerte
    $con = mysql_connect("localhost", "root", "");
    if (!$con) {
    die("Error: " . mysql_error());
    }
    //Auswahl der Datenbank 'sample' und deren Tabelle 'countries'
    mysql_select_db("sample", $con);
    $result = mysql_query("SELECT * FROM countries");
    ?>
    <!DOCTYPE html>


    DataTables

    <!-- Einbindung externer Dateien bzw JavaScript-Bibliotheken und Cascading Style Sheet -Vorlagen -->



    @import "jslib/DataTables-1.9.4/media/css/demo_table_jui.css";
    @import "jslib/jquery-ui-1.9.1.custom/css/smoothness/jquery-ui-1.9.1.custom.css";


    *{
    font-family: arial;
    }

    <!-- Einrichtung des DataTables-Plugins -->

    $(document).ready(function(){
    $('#datatables').dataTable({
    "sPaginationType":"full_numbers",
    "aaSorting":[[2, "desc"]],
    "bJQueryUI":true
    });
    })

    <!-- Einrichtung des Selektierens einzelner Reihen. Highlighting Rows -->
    var oTable;

    $(document).ready(function() {
    /* Add a click handler to the rows - this could be used as a callback */
    $("#example tbody tr").click( function( e ) {
    if ( $(this).hasClass('row_selected') ) {
    $(this).removeClass('row_selected');
    }
    else {
    oTable.$('tr.row_selected').removeClass('row_selected');
    $(this).addClass('row_selected');
    }
    });

    /* Add a click handler for the delete row */
    $('#delete').click( function() {
    var anSelected = fnGetSelected( oTable );
    if ( anSelected.length !== 0 ) {
    oTable.fnDeleteRow( anSelected[0] );
    }
    } );

    /* Init the table */
    oTable = $('#example').dataTable( );
    } );


    /* Get the rows which are currently selected */
    function fnGetSelected( oTableLocal )
    {
    return oTableLocal.$('tr.row_selected');
    }







    ID
    Country
    Population
    Internet Users
    Penetration (% Population)
    World % Users



    <?php
    while ($row = mysql_fetch_array($result)) {
    ?>

    <?=$row['ID']?>
    <?=$row['Country']?>
    <?=$row['Population']?>
    <?=$row['Internet Users']?>
    <?=$row['Penetration']?>
    <?=$row['World Users']?>

    <?php
    }
    ?>




    Eine Seite mit der Grafischen Auswertung




    [/code]
  • robertbrowerrobertbrower Posts: 158Questions: 1Answers: 0
    edited February 2013
    Allen, do you need to add a security exception for every file you want to open on your desktop that uses table tools? I hope not. That would really throw a monkey wrench into things here.

    Thanks.

    Robert
  • allanallan Posts: 61,934Questions: 1Answers: 10,155 Site admin
    Only if you are running the SWF from file://. That's not something I can control, it is a security feature built into Flash. If you are running from a web-server, then no such exception should be needed.

    Allan
  • robertbrowerrobertbrower Posts: 158Questions: 1Answers: 0
    I understand why. It is a real shame that there is no way around it because this is an intranet application and I am not concerned so much about this security point. I guess I will look into formatting the CSV in javascript and opening it in a new window. =(
  • allanallan Posts: 61,934Questions: 1Answers: 10,155 Site admin
    It will work on an intranet web server, it just won't work being served from file://. If that is something that you need, then I'd suggest filing a bug with Adobe, but I doubt they'll change it as there are far to many security concerns.

    Allan
This discussion has been closed.