How to call TableTools functions instead of using the buttons

How to call TableTools functions instead of using the buttons

nlz242nlz242 Posts: 17Questions: 0Answers: 0
edited November 2012 in TableTools
I'm sure this is fairly simple, however after searching i didn't find any thread asking about this.

I'd like to call TableTools functions directly, so i can integrate them in my existing UI.
For example, my UI has a menu bar with drop-down. I'd like to have a "Print" sub-menu with "Print (all columns)" and "Print (current columns)" (using ColVis). I'd also like to have a similar sub-menu for Excel.

Should i make custom buttons using "aButtons" and then use jQuery appendTo to move them somewhere else? While this would work, it doesn't seem like it would be the best method to achieve the result i'm looking for.
Being able to directly call the functions from the 's inside my / seems to be the best option. Anyone's done that or could put me in the right direction?

Thanks in advance!

Replies

  • allanallan Posts: 63,497Questions: 1Answers: 10,470 Site admin
    For print you can use the fnPrint API method: http://datatables.net/extras/tabletools/api#fnPrint . However, there is no equivalent method for the export / copy buttons since Flash requires that a mouse click be used to activate that functionality (security feature of Flash).

    Allan
  • nlz242nlz242 Posts: 17Questions: 0Answers: 0
    Hi Allan,

    Thanks for the quick answer.
    For fnPrint, it looks like it should work, ill try that out.

    Looking at TableTools, i also realised that it would be difficult to implement Excel exportation as im using server side processing. I guess i'll bypass DataTables and just create an excel file, server side, by providing the colVis and colOrder settings from the table to my server. I'll have to figure out how to read those, that shouldnt be too hard i guess.

    Thanks!
This discussion has been closed.