Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
2715 Lượt xem

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


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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

new Tooltip with capital T , you use that ?

Tác giả

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

Tác giả Câu trả lời hay nhất

xml file :


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 25
1722
Odoo App Đã xử lý
1
thg 11 23
2321
0
thg 5 24
2025
0
thg 9 23
2950
0
thg 9 23
2617