コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
1284 ビュー

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?

アバター
破棄
最善の回答

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/

アバター
破棄
著作者 最善の回答

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

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

アバター
破棄
関連投稿 返信 ビュー 活動
5
3月 25
2860
1
2月 25
1395
0
11月 24
976
2
10月 24
1610
1
10月 24
11745