placement of print button, bootstrap 4, (put "B" where "l" used to be)
placement of print button, bootstrap 4, (put "B" where "l" used to be)
I've got the button extension working!! Specifically, the "print" extension, where DT will create a printable version of the table However, I'm trying to find and/or understand the documentation to place the print button where I'd like. It'd be great to place it in the upper-left hand corner, where the [length changing input control] is. There's a bootstrap row with two columns here, one for the page length chooser, and the other for the search filter.
Additionally, if I wanted to create a whole row of my own button inputs, I would love to see a snippet of how to get it working.
This question has an accepted answers - jump to answer
Answers
Use Buttons' direct insertion:
https://datatables.net/extensions/buttons/#Direct-insertion
@tangerine I was trying to find that from earlier, thank you.
My comments below are probably stupid. I'm not personally familiar with using the
new
constructor. I initialize the table, I suppose, like a novice (see below).Does DT recommend using vars and then calling the
new
constructor to bring tables into existence (as demonstrated in the link you've referenced)? Is this the only way I'll be able toappendTo
thedt-buttons
?There is a Bootstrap example showing how to use Buttons here. The
dom
option for Bootstrap is a lot more complex then you have here. I would suggest doing it using the direction insertion way as tangerine suggested and as shown in the example I linked to.Allan
@allan That's pretty much what I wanted to do, thank you for that snippet!
It's important to note that
dom
ought not be included when using.appendTo()
to position the toolbar; or, at least not in my scenario. I noticed that if I includeddom: Bftipr
, their respective displays were offset in their own rows, as opposed to rows with two colums. So, commenting outdom
made everything nice and tidy.