Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Vue Metronic 8 - Tooltip HTML


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>


2 problems
1. "data-html="true" doesnt do anything and if I try to add HTML into the tooltip, it just renders the raw HTML tags (I tried also data-bs-html etc )
2. Defining .tooltip style on the page doesnt apply - I cannot seem to be able to override the style locally.

I did notice that on the Calendar app, since the tooltip is generated by the <script> section, both HTML and .tooltip works. But I just dont see a any event for the datatable that I can attach to which would give me the ability to create a tooltip for each cell.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)


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;
}


Other example I took from getbootstrap.com and have the same issues I mentioned:

<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-tooltipdirective.

<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>


Regards,
Lauris Stepanovs,
Keenthemes Support Team



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);
});


Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(