DataTables 1.10.13 colVis (Buttons) customize column title
DataTables 1.10.13 colVis (Buttons) customize column title
musium
Posts: 11Questions: 5Answers: 0
I’m looking for a way to customize the column title displayed by the colVis button.
I’ve a DataTable with a filter for each column (input in the header).
Some columns have a select element as filter. colVis displays each options of these selects concatenated to one text as title for the column.
Is there a way to customize the text displayed for each column?
This discussion has been closed.
Answers
Not directly I'm afraid. I would probably recommend that you have a second row in your header which you can put the
select
elements into to avoid this.Having said that, there is the
button().text()
method which could be used - you would need to loop over the buttons and update them as required.This is something I am aware of and need to improve. Its on the roadmap (although its not likely to happen in the near future).
Allan
Thank you allan for your answer.
The first option, creating a second header row, does not work since the responsive plugin only supports one header row (I’m using the responsive plugin for my tables).
The second option could work, but I ccould not find a way to get only the “column-buttons” of colVis, I only managed to get all buttons. Is there a way to get/iterate over the “column-buttons” of colVis?
Ah yes. Fair point - I wouldn't have mentioned that if I'd known.
Hummm... You can get them individually using the sub-button selector, but you'd need to know in advance the indexes, which isn't all that great programming-wise.
It would be good if that could accept
\d-
to get all sub buttons for a parent.Better yet, the
colVis
button should really offer a callback function for the button title, as this isn't the first time that has been requested.I've got it on my bug list!
Allan