Badges and Tooltips integration with Bootstrap4
Badges and Tooltips integration with Bootstrap4
dt1
Posts: 52Questions: 5Answers: 0
I have tried to use bootstrap4 Badges classes inside tables but they casue some kind of columns mis allignments.
In addition I have tried to use the Bootstrap4 tooltips with some Buttons and I'm getting only the HTML tooltips style and not the Bootstrap4 sytle. Was this ever tested?
Thanks
Elan
This question has accepted answers - jump to:
This discussion has been closed.
Answers
I would like to see how you are implementing tooltips in BS4.
I'm referring to tooltips that are part of the data in the Table. (they can be attached to Links, Buttons, etc but only inside the table)
If defined in the HTML part of the page the tooltips work OK
Elan
Hi Elan,
The issue is that you are initialising the tooltips (
$('[data-toggle="tooltip"]').tooltip();
) and then loading the DataTable data. So the tooltips were initialised before the HTML for the table data was present on the page - hence why they aren't Bootstrap styled.Add:
immediately after your DataTable initialisation to resolve.
Allan
Seems like
drawCallback
would need to be used or the tooltips won't be initialized on the first page when the Datatable is initialized. Thedraw
event doesn't seem to fire until the next draw takes place after Datatables initialization.Example here:
http://live.datatables.net/nawocuye/2/edit
Kevin
Yup - if you are Ajax loading the data, that isn't an issue, since another draw will occur when the data has been loaded and the event listener added. However, you can listen for
draw.dt
from jQuery - add it before the DataTable is initialised: http://live.datatables.net/nawocuye/3/edit .Allan
Thats good to know. Been tripped up by using the
draw
event with DOM based data before. Now I know whyKevin
@allan @kthorngren and now you see why I like to help in the forums. It also teaches me so I can better use DataTable. (it is used heavily in my web site).
@bindrid
Me too!
Kevin
Thank you all.
Your recommnedations and comments helped me to sort the issue of Tooltips out.
But what about Bootstrap Badges?
They sim to casue some issues as well.