-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dropdown not being updated to dynamic options through custom js, overridden to default. #3703
Dropdown not being updated to dynamic options through custom js, overridden to default. #3703
Conversation
Not able to overwrite dropdown from version 3.2, because of default here https://github.com/railsadminteam/rails_admin/blob/b09f770d9f2b743626d5f29ac9449dbcce9e5c70/src/rails_admin/filtering-select.js#L300
26b4d15
to
2dceb62
Compare
Hi, Thanks for your attention, let me know if this is worth merging or not, so i can close this pr. |
Thanks for the PR. Could you please show me your custom js? |
Yeah sure, here is the sample code from erb file which i am using for state selection based on country selected dynamically.
|
The problem is purely in your usage of the filtering-select widget. try { $(selector).filteringSelect('destroy'); } catch (e) { }
$(selector).filteringSelect(); What this does is not refreshing, but it destroys the filtering-select widget and then re-creates. Also if your lists of countries and states are stored in DB, client-side dynamic scoping feature that was added recently will fit well with this sort of use-cases. |
@mshibuya i will try this, thanks a lot for your help. |
Not able to overwrite dropdown from version 3.2 onwards, because of default here
rails_admin/src/rails_admin/filtering-select.js
Line 300 in b09f770
it's done in (#3630).
my use case is that i am overwriting the states picklist based on country picklist through custom js.
and to make the new dropdown work after updating the options, i am using
$(selector).filteringSelect('destroy')
to reinitialize. but its being overwritten with that line, we can add one boolean flag to ignore that behaviour.