Multiple TableTools on Multiple tables using alternate initialization not working, lone tables work.

Multiple TableTools on Multiple tables using alternate initialization not working, lone tables work.

callumcarolancallumcarolan Posts: 8Questions: 0Answers: 0
edited January 2012 in TableTools
I have 2 tables on 1 page and a TableTools on each one however the buttons do not work, I have many other single TableTools on many other tables however they're only 1 table, with more than 1 table they do not seem to work, could anyone help find a solution?

Replies

  • morrtymorrty Posts: 29Questions: 6Answers: 0
    Same problem. Two tables, one page. The print button works on both, the xls and csv only work on table one, not on table two.
  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    It would work okay. Can either of you give me a link to your page please?

    Allan
  • callumcarolancallumcarolan Posts: 8Questions: 0Answers: 0
    Unfortunately I can't since it's on my local server, when I get home I can show you the code though
  • morrtymorrty Posts: 29Questions: 6Answers: 0
    I fixed mine by reading other threads.

    I used "fnResizeButtons" as seen here: http://datatables.net/extras/tabletools/api

    I'm using jQuery Tabs which I didn't realize was causing the issue.
  • callumcarolancallumcarolan Posts: 8Questions: 0Answers: 0
    Here is my javascript:
    [code]
    $(function(){
    oTable = $('.dataTable').dataTable({
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "sDom": '<""f>t<"F"lp>'
    });
    var oTableTools = new TableTools( oTable, {
    "sSwfPath": "http://crm_darkreport/js/dataTables/swf/copy_cvs_xls_pdf.swf",
    "buttons": [
    "copy",
    "csv",
    "xls",
    "pdf",
    { "type": "print", "buttonText": "Print me!" }
    ]
    } );

    $('.tabletools').before( oTableTools.dom.container );
    });
    [/code]

    and here is my HTML:
    [code]





    Contacts



    Name
    Address
    City
    State
    Zip
    Title
    Email
    Phone



    <?php echo $contactRows; ?>












    Payments



    Invoice
    Payment Date
    Amount
    Note



    <?php echo $accountRows; ?>






    [/code]
  • callumcarolancallumcarolan Posts: 8Questions: 0Answers: 0
    no insight into why it's not working?
  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    Looks like it should be working. You say you use fnResizeButtons - how do you use it? Any script errors or anything else? What are the symptoms?

    Allan
  • callumcarolancallumcarolan Posts: 8Questions: 0Answers: 0
    I personally don't use fnResizeButtons, I tried it but with no avail.
  • callumcarolancallumcarolan Posts: 8Questions: 0Answers: 0
    And after debugging the JS and code it shows no errors, warnings or notices.
  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    I see. It just that you said:

    > I used "fnResizeButtons" as seen here: http://datatables.net/extras/tabletools/api

    So, is it in a tab? If so, you will likely need to use the resize function when the tab is made visible. You can do that something like this http://datatables.net/release-datatables/examples/api/tabs_and_scrolling.html (although obviously called fnResizeButtons).

    Allan
  • callumcarolancallumcarolan Posts: 8Questions: 0Answers: 0
    morrty said that, mine are not in tabs
  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    Sorry - in that case, as far as I can see, your code should be working. The only thing that stands out for me is the absolute URL. I'd suggest making that relative otherwise you might run into cross domain issues.

    Allan
  • callumcarolancallumcarolan Posts: 8Questions: 0Answers: 0
    Could it be to do with the edited sDom?
This discussion has been closed.