Tooltips? #714
Replies: 1 comment
-
The main issue with your code is that the table columns are not in the page at the moment the page is initialized. They are fetched with ajax and only after that, displayed in table. To globally add tooltips to your application you can do the following: 1 - Create a file, say document.addEventListener("DOMContentLoaded", function(event) {
if(document.body.contains(document.getElementById('crudTable'))) {
$('#crudTable').on("draw.dt", function(e) {
initTooltipsOnPage();
});
}
initTooltipsOnPage();
});
function initTooltipsOnPage() {
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
});
} 3 - Tell Backpack to load that file on every page by going to // ... rest of the file
'scripts' => [
'assets/js/enabled_tooltips.js'
],
// ... rest of the file Any element you want a tooltip, for example in a text column, you can just do: CRUD::column('test')->wrapper(['data-bs-toggle' => 'tooltip', 'title' => 'your tooltip text']); Hope that helps. Cheers |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How is it possible to show tooltips from within the SetupListOperation? I've tried the following:
I've even tried adding a
'js/admin/custom.js'
inside my ui.php config, and the contents of that file looks like this:Yet, none of these seem to be working? but if I open my console on Chrome & C+P the code, it works?
Beta Was this translation helpful? Give feedback.
All reactions