跳至內容
選單
此問題已被標幟
3 回覆
2451 瀏覽次數

Hi

I want to use the https://getbootstrap.com/docs/5.2/components/tooltips/


But when I use it, it gives me an error and says that Bootstrap is unknown

But I use the other features of Bootstrap in the XML file and there is no problem

How can I use the Bootstrap tooltip feature in odoo 16?

Thanks


  • js file:

    const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]') const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))


    in console show: bootstrap is not defined !!!!

xml file: 

after posting remove my code !!
I use the same simple examples from the Bootstrap site


When I try without a JS file and there is only an XML file

Tooltips are displayed, but they do not have the styles that are in  Bootstrap website


頭像
捨棄
最佳答案

I think it's the same as my problem:
See the proposed solution there:
https://www.odoo.com/de_DE/forum/hilfe-1/use-standard-bootstrap-functionality-270303

頭像
捨棄
最佳答案

In js i think we only need new Tooltip, check this file https://github.com/odoo/odoo/blob/03856863a644fbc588edb6e63168a6c4e15d5d92/addons/web_editor/static/src/js/editor/snippets.editor.js#L2062

頭像
捨棄
作者

tnx.....but I use new tooltip , then get error :
tooltip is not defind

new Tooltip with capital T , you use that ?

作者

yeah,but get error: Uncaught ReferenceError: Tooltip is not defined;

Is it necessary to use the JS file in certain conditions and types???
(I mean, are there any dependencies from odoo required or not)
Because I have a normal JS file that I linked to XML

Normal js file ?, in order to work your js file need to contain this at the top of the file: /** @odoo-module **/

作者 最佳答案

xml file :


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
4月 25
1415
Odoo App 已解決
1
11月 23
2010
0
5月 24
1728
0
9月 23
2673
0
9月 23
2297