Is the "new TableTools()" example working properly?

Is the "new TableTools()" example working properly?

wulfhartwulfhart Posts: 4Questions: 0Answers: 0
edited June 2013 in TableTools
I searched for an answer, but couldn't find one on the forum or google

I was troubleshooting an issue where changing buttons during setup wouldn't change what was displayed and found the same problem on the example page.

The example is here http://datatables.net/release-datatables/extras/TableTools/alt_init.html

The initialization for the example page is:
[code]
$(document).ready( function () {
var oTable = $('#example').dataTable();
var oTableTools = new TableTools( oTable, {
"buttons": [
"copy",
"csv",
"xls",
"pdf",
{ "type": "print", "buttonText": "Print me!" }
]
} );

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

However, it displays the 5 default buttons without a customized "print" button. The "Print" button does not say "Print me!" as was specified in setup.


Is this an error or am I mistaken?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Not entirely sure how I managed that (possibly something to do with my work on DataTables 1.10) but it should be sType and sButtonText: http://datatables.net/extras/tabletools/button_options#sButtonText .

    Sorry about that.

    Allan
  • wulfhartwulfhart Posts: 4Questions: 0Answers: 0
    Thank you for the fast response.

    I redid the example here http://live.datatables.net/aninuf/4/edit

    I changed it to sType and sButtonText, but nothing changed. I then removed both the "print" button and "xls" button. It still displayed 5 default buttons.

    Further experiment showed that if I modify TableTools.DEFAULTS.aButtons the buttons will change, but this doesn't seem like the proper method of customizing buttons.
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Uh - I missed `buttons` in my dodgy example as well... It should be aButtons: http://live.datatables.net/aninuf/5/edit .

    And I think sExtends rather than sType... That example didn't really go very well did it... :-(

    Allan
  • wulfhartwulfhart Posts: 4Questions: 0Answers: 0
    Sorry for the delay of my response.

    It works great now. Thank you very much.
  • wulfhartwulfhart Posts: 4Questions: 0Answers: 0
    This is probably my misunderstanding, but the buttons don't seem to be functional. On the live example, only the print button seems to do anything.

    http://live.datatables.net/aninuf/5/edit
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    The TableTools CSS wasn't being included: http://live.datatables.net/aninuf/6/edit

    Allan
This discussion has been closed.