تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
1244 أدوات العرض

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
مارس 25
2826
1
فبراير 25
1352
0
نوفمبر 24
940
2
أكتوبر 24
1575
1
أكتوبر 24
11734