TableTools: is there a way to call fnPrint from outside the normal button functions?
TableTools: is there a way to call fnPrint from outside the normal button functions?
fortyCakes
Posts: 3Questions: 1Answers: 0
For example, if I have a button on my page separate from the entire table, can I somehow call fnPrint from that button's onClick and have it work? All of the examples call fnPrint from one of the TableTools buttons, which isn't what I want.
(I would include an example of what I'm trying to do but I can't get TableTools to work in DataTables-live)
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Sure - use the
fnPrint
method. It can be called on the TableTools instance.Allan
Having done:
and then tried to call
which gives me the JS error:
Have I got the syntax for the call wrong? I can't find what the correct syntax for calling it should be.
(This is with DataTables 1.10.6 and TableTools 2.2.4; the basic TableTools buttons work, including the print button, when I include them in the 'dom' attribute.)
Yes, there is no
$('.table-auto').DataTable.TableTools
option. If you found that in the documentation, could you show me where so I can correct it please?You want to use:
Very ugly... I'm working on a better solution!
Allan
Thanks!
No, it wasn't in the docs, I'd just missed the section about static and instance methods.