Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
1411 Widoki

I am trying to show my Bootstrap dropdown menu on t-on-keyup. 

When i try to call new bootstrap.Dropdown(element) is says that it's undefined.

If I'm correct, bootstrap is already inside the odoo system. So I don't have any imports for bootstrap in my application.

This is the function I am trying to call:

showDropdown = (dropdownElement) => {
    if (dropdownElement) {
​const dropdown = new bootstrap.Dropdown(dropdownElement);
​dropdown.show();
    }
}

Do I still need to import bootstrap individually? Or am I doing something else wrong?

Awatar
Odrzuć
Najlepsza odpowiedź

For anyone else wondering, I think it depends on the bootstrap version being used. 

For me it worked with:

$("#element_id").modal("show") # or .modal("hide")

More here: getbootstrap.com/docs/4.0/components/modal/

Awatar
Odrzuć
Autor Najlepsza odpowiedź

I found out that you can access DOM elements via jQuery like this "$(element)".

So I made it work with $('#dropdownElement').show()

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
5
mar 25
3161
1
lut 25
1556
0
lis 24
1041
2
paź 24
1716
1
paź 24
11830