Some doubts about Buttons extension
Some doubts about Buttons extension
Hello there!
I have some doubts related to Buttons extension. I am trying to migrate everything coded using TableTools but I'm having some problems...
In TableTools there were two options that I can't find in Buttons:
1.- Buttons ToolTip. I can't remember if I added this option manually, but I'm sure it was available for Print button. This adds a tooltip to the button, using HTML Title property. Does this exist in Buttons extension?
2.- fnRowSelected and fnRowDeselected. These two functions were available from defaults TableTools options
( $.extend(true, $.fn.dataTable.TableTools.defaults, { 'fnRowSelected': function ( nodes ) { ... } } ) but now the only docs related to these functions are https://datatables.net/reference/event/select and https://datatables.net/reference/event/deselect . How can I set defaults for both?
3.- Buttons actions only over visible columns. In TableTools there is an option for this, but I can't find the option in Buttons/Select. For example, if I click "Copy" button when only one row is selected, I want to copy only that one row, not the whole table.
Thanks,
Best regards
This question has accepted answers - jump to:
Answers
Tooltips can be added using the
titleAttr
property of the button in thebuttons
array.Actions over only visible columns can be specified using the
exportOptions
property of the button.I think you are looking for something like:
(along with other properties of your button, and other buttons, if any)
As for your second question I don't know.
There is no longer a callback option for these actions - you need to use events. If you need to assign a default action you could listen for the
init
event and then attach theselect
anddeselect
events to the newly initialised table as you require.Allan
What a quickly response!! Thanks!!
So, I have this:
With this, I have questions 1 and 3 solved.
My problem comes with option 2. Allan, I think your idea sounds very good, but I am not able to get it done :(
I tried with initComplete without success:
Maybe I don't know what to put instead of
this
... Any idea?I would be surprised if that wasn't giving a Javascript error is it not?
this
does not have anon()
method ininitComplete
.Try using
this.api().on( ... );
Allan
Oh - and note that if you use
initComplete
in your configuration options it would overwrite the default.Nice, everything works now.
Thanks!!!