Skip to content

Commit 2e5d776

Browse files
committed
Make tooltips compatible with BS5.
1 parent abd3e1c commit 2e5d776

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/webapp/js/table.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global jQuery3, luxon, tableDataProxy */
1+
/* global jQuery3, luxon, tableDataProxy, bootstrap5 */
22
jQuery3(document).ready(function () {
33
/**
44
* Binds all tables that have the class 'data-table' to a new JQuery DataTables instance.
@@ -32,7 +32,7 @@ jQuery3(document).ready(function () {
3232
return '-';
3333
}
3434
var dateTime = luxon.DateTime.fromMillis(data * 1000);
35-
return '<span data-toggle="tooltip" data-placement="bottom" title="'
35+
return '<span data-bs-toggle="tooltip" data-bs-placement="bottom" title="'
3636
+ dateTime.toLocaleString(luxon.DateTime.DATETIME_SHORT) + '">'
3737
+ dateTime.toRelative({locale: 'en'}) + '</span>';
3838
}
@@ -53,7 +53,6 @@ jQuery3(document).ready(function () {
5353
const tableConfiguration = JSON.parse(table.attr('data-table-configuration'));
5454
// overwrite/merge the default configuration with values from the provided table configuration
5555
const dataTable = table.DataTable(Object.assign(defaultConfiguration, tableConfiguration));
56-
5756
// add the buttons to the top of the table
5857
if (tableConfiguration.buttons) {
5958
dataTable
@@ -76,7 +75,10 @@ jQuery3(document).ready(function () {
7675
(function () {
7776
const model = JSON.parse(t.responseObject());
7877
dataTable.rows.add(model).draw();
79-
jQuery3('[data-toggle="tooltip"]').tooltip();
78+
jQuery3('[data-bs-toggle="tooltip"]').each(function () {
79+
const tooltip = new bootstrap5.Tooltip(jQuery3(this)[0]);
80+
tooltip.enable();
81+
});
8082
})();
8183
});
8284
}

0 commit comments

Comments
 (0)