Using Select with Buttons not working correctly
Using Select with Buttons not working correctly
I am attempting to combine the 'Select' and 'Buttons' extensions in a simple way to allow me to have a checkbox in the first column and the buttons; copy, print, pdf, etc... above. Previously when I used TableTools if I select 1, 2, 3, etc... rows then only the selected rows would be copied, printed, etc.... Now, using 'Buttons', every row in my table is included no matter what rows I have actually selected.
The selection is working because my table is showing, for example, "Showing 1 to 3 of 3 entries 2 rows selected".
Any idea why this could be failing? Select works and Buttons works but not together?
I am happy to send a link via a PM.
Cheers
Chris
Answers
Hi Chris,
With buttons you need to tell it that you want it to export only selected rows. The
buttons.buttons.exportOptions
parameter is used for this. It is an object that is passed through to thebuttons.exportData()
method to get the data from the table.In this case,t he
rows
option is the one you want to use - specifically theselected
parameter (row-selector
).For example:
Allan
Hi Allan,
Thanks for the answer. How do I set a default value though, i.e. if no rows are selected then export all data and if X number of rows are selected just export those?
Thanks
Chris
Hi Chris,
Good question. There is no option for that at the moment unfortunately. Let me have a think about the best way of presenting such an option.
Allan
Okay many thanks, hope you can come up with a solution!