Wrap Table Header Buttons
Wrap Table Header Buttons
![AlexanderLamas](https://secure.gravatar.com/avatar/19be16931faaed8d04336c19654885d8/?default=https%3A%2F%2Fvanillicon.com%2F19be16931faaed8d04336c19654885d8_200.png&rating=g&size=120)
Hi guys,
When you have added buttons in the header of your table, you would have something like this
<div class="dt-buttons">
<button class="dt-button" tabindex="0" aria-controls="example" type="button">
<span>My button 1</span>
</button>
<button class="dt-button" tabindex="0" aria-controls="example" type="button">
<span>My button 2</span>
</button>
<button class="dt-button" tabindex="0" aria-controls="example" type="button">
<span>My button 3</span>
</button>
</div>
How can I wrap ONLY the buttons 1 and 2 in a div?
This is what I want to achieve
<div class="dt-buttons">
<div class="SpecialButtons">
<button class="dt-button" tabindex="0" aria-controls="example" type="button">
<span>My button 1</span>
</button>
<button class="dt-button" tabindex="0" aria-controls="example" type="button">
<span>My button 2</span>
</button>
</div>
<button class="dt-button" tabindex="0" aria-controls="example" type="button">
<span>My button 3</span>
</button>
</div>
Thank you very much!
This discussion has been closed.
Replies
There isn't currently a way to do that in Buttons I'm afraid. It should be possible to use jQuery / DOM methods to "wrap" the button elements, but that isn't something I've actually tried.
Allan
Hi Allan,
Thanks for your reply.![:) :)](https://datatables.net/forums/resources/emoji/smile.png)
I will try to use jQuery methods to achieve that.
Let's what I can come up with.
Thank you!
Regards,
Alex
Hi Allan,
Thanks for your reply.
Another idea...
Is it possible to add a button in the same header section after the table API is fully loaded?
I was thinking of that I could add a class for the buttons I want to wrap and after the API is been loaded I added the button that won't be wrapped.
Please let me know if that is possible, and, if you can, please give some examples or some links where I can see how to achieve that.
Thank you very much.
Regards,
Alex
Yes -
button().add()
can be used to add a button.Allan