Hi,
I am trying to get the datatable cells to have a tooltip and it part works:
<template v-slot:taster="{ row: item }">
<div
v-html="getMoreInfo(item.Id, `name`)"
data-toggle="tooltip"
data-placement="top"
data-html="true"
:title="getTasterInfo(item.Id, `tooltip`)"
></div>
</template>
Example style I defined on the page to no effect:
.tooltip {
position: absolute;
z-index: 9999;
background: #ffc107;
color: black;
width: 150px;
border-radius: 3px;
box-shadow: 0 0 2px;
}
<button
type="button"
class="btn btn-secondary"
data-bs-toggle="tooltip"
data-bs-html="true"
data-bs-title="<em>Tooltip</em> <u>with</u> <b>HTML</b>"
>
Tooltip with HTML
</button>
Hi Chris,
You can add tooltips using our v-tooltip
directive.
<button
type="button"
class="btn btn-secondary"
v-tooltip
data-bs-html="true"
data-bs-title="<em>Tooltip</em> <u>with</u> <b>HTML</b>"
>
Tooltip with HTML
</button>
Hi Lauris,
v-tooltip did not resolve the issues I mentioned. Instead I get:
[Vue warn]: Failed to resolve directive: tooltip
As I said, data-bs-toggle="tooltip" works, but I cannot style it and I cannot add HTML inside the title property.
Here is what I got (same thing happens outside of datatable):
<Datatable
@on-sort="sort"
@on-items-select="onItemSelect"
:data="tableData"
:header="tableHeader"
:enable-items-per-page-dropdown="true"
:checkbox-enabled="true"
checkbox-label="id"
:loading="loading"
>
<template v-slot:taster="{ row: item }">
<div
v-html="getMoreInfo(item.cognitoUserId, `name`)"
data-bs-toggle="tooltip"
data-bs-placement="top"
data-bs-html="true"
:title="getMoreInfo(item.cognitoUserId, `tooltip`)"
></div>
</template>
Hi Chris,
Which Metronic version are you using?
We have added a tooltip directive in the latest Metronic v8.1.6 release.
If you are using older versions then you can register this directive in file src/main.ts.
app.directive("tooltip", (el) => {
new Tooltip(el);
});