dpgaspar / Flask-AppBuilder

Simple and rapid application development framework, built on top of Flask. includes detailed security, auto CRUD generation for your models, google charts and much more. Demo (login with guest/welcome) - http://flaskappbuilder.pythonanywhere.com/
BSD 3-Clause "New" or "Revised" License
4.7k stars 1.36k forks source link

Bug Select2SlaveAJAXWidget not loading options [4.5.1] #2271

Open kmorkah opened 2 months ago

kmorkah commented 2 months ago

found the related_fields example in Select2SlaveAJAXWidget code. There is no popup in select2 ajaxwidget. It seems like this bug has been around for quite some time.

Environment

Flask-Appbuilder version: 4.5.1

pip freeze output:

apispec==6.6.1 attrs==24.2.0 babel==2.16.0 blinker==1.8.2 click==8.1.7 colorama==0.4.6 Deprecated==1.2.14 dnspython==2.6.1 email_validator==2.2.0 Flask==2.3.3 Flask-AppBuilder==4.5.1 Flask-Babel==2.0.0 Flask-JWT-Extended==4.6.0 Flask-Limiter==3.8.0 Flask-Login==0.6.3 Flask-SQLAlchemy==2.5.1 Flask-WTF==1.2.1 greenlet==3.1.0 idna==3.8 importlib_metadata==8.5.0 importlib_resources==6.4.5 itsdangerous==2.2.0 Jinja2==3.1.4 jsonschema==4.23.0 jsonschema-specifications==2023.12.1 limits==3.13.0 markdown-it-py==3.0.0 MarkupSafe==2.1.5 marshmallow==3.22.0 marshmallow-sqlalchemy==0.28.2 mdurl==0.1.2 ordered-set==4.1.0 packaging==24.1 pkgutil_resolve_name==1.3.10 prison==0.2.1 Pygments==2.18.0 PyJWT==2.9.0 python-dateutil==2.9.0.post0 pytz==2024.2 PyYAML==6.0.2 referencing==0.35.1 rich==13.8.1 rpds-py==0.20.0 six==1.16.0 SQLAlchemy==1.4.54 SQLAlchemy-Utils==0.41.2 typing_extensions==4.12.2 Werkzeug==3.0.4 wrapt==1.16.0 WTForms==3.1.2 zipp==3.20.1

Steps to reproduce

Run the related_fields example. Load the create contact page. Select a group Open the select for sub-group 스크린샷 2024-09-13 10-02-16 You will not see a pop-up as shown below.

ThomasP0815 commented 1 month ago

Possible fix:

replace "select2.min.js" in templates/appbuilder/init.html with "select2.full.min.js"

<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.full.min.js" nonce="{{baselib.get_nonce()}}"></script>

stackoverflow stackoverflow

related to #2021

kmorkah commented 1 month ago

Possible fix:

replace "select2.min.js" in templates/appbuilder/init.html with "select2.full.min.js"

<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.full.min.js" nonce="{{baselib.get_nonce()}}"></script>

stackoverflow stackoverflow

realated to #2021

Thanks for the advice. First of all, it's resolved.