Multiple DOM

Multiple DOM

RobaybRobayb Posts: 9Questions: 0Answers: 0
edited August 2010 in General
I have 2 Tabletools on a page and only the first one actually works for the csv and Excel features.

The scenerio is that I load the first table and then load the second table (via a link) in a seperate div on the same page.

What is the proper syntax for using Multiple Dom and Tabletools together. In the documentation what is meant by "...Simply include the feature's identification letter where you want it to appear"...what is the Tabletools identification letter?

I am currently just using:
"sDom": 'T<"clear">lfrtip' on each page

Can't seem to get it right. Thx

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    The letter 'T' is TableTools' identification letter. Just include it twice: 'T<"clear">lfrtipT' and hopefully that will do the trick.

    Allan
  • RobaybRobayb Posts: 9Questions: 0Answers: 0
    Thanks - please help
    By adding the T - I now have the tabletools icons on both the bottom and top of the table and they still don't work on the 2nd table.
    I am using this same code on each page but changing the the table name of course:

    TableToolsInit.sSwfPath = "dataTables-1.6/extras/TableTools/media/swf/ZeroClipboard.swf";
    $('#myTable1').dataTable( {
    "sDom": 'T<"clear">lfrtipT',
    "bJQueryUI": true,
    "bLengthChange": false,
    "bPaginate": false,
    "bSearchable": false,
    "bFilter": false,
    "aaSorting": [[ 6, "asc" ]],
    "aoColumns": [
    null,
    null,
    null,
    { "sType": "percent" },
    null,
    null,
    { "sType": "percent" },
    null,
    null,
    null,
    null,
    null,
    null,
    null

    ]});
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    I presume the code you've got is effectively duplicated for the second table? What happens, a JS error, does the TableTools element get shown? Perhaps you can give us a link to make debugging a bit easier.

    Allan
  • RobaybRobayb Posts: 9Questions: 0Answers: 0
    Hi Allan - Thanks for your help so far. I have not resolved this issue yet..I have posted two example mockups.
    This one works fine when I have two tables on one page:
    http://www.greenearthcrew.com/dataTableExample.html

    This one does NOT work when I load the second table with .load function. I have tried it with the "T" as you suggest and without. With the "T" it duplicates the Icons. Also, as you will see the top table does not copy/save, it will copy/save the bottom table instead:
    http://www.greenearthcrew.com/dataTableExampleSample2.html

    Please help - Thank you
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Have a look at this question on StackOverflow - it's to do with $.load and how it handls loading Javascript, rather than an issue with DataTables: http://stackoverflow.com/questions/889967/jquery-load-call-doesnt-execute-javascript-in-loaded-html-file .

    Allan
This discussion has been closed.