Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add new item to the end of ordered multiselect instead of beginning #2167

Merged

Conversation

dwbutler
Copy link
Contributor

I'm using the filtering multiselect in a nested form with orderable: true. For our use case, it is very important that elements are always in the right order.

I noticed that when you create a new item, visually the new <option> appears to be added as the last child of the <select>. But when the form is submitted to Rails, the new IDs have actually been inserted at the beginning instead of at the end.

I finally tracked this down to a hidden <select> which is the real one submitted via Ajax. Changing prepend to append fixed the issue, causing new <option>s to be inserted at the end of the hidden <select>.

I would be happy to write some specs, but I couldn't find any existing specs for the multiselect widget. Maybe I just need to be pointed to the right file or create a new one.

@luizpicolo
Copy link
Contributor

👍

@dwbutler
Copy link
Contributor Author

dwbutler commented Aug 3, 2015

@sferik Anything blocking this from getting merged?

mshibuya added a commit that referenced this pull request Aug 4, 2015
Add new item to the end of ordered multiselect instead of beginning
@mshibuya mshibuya merged commit f8647e6 into railsadminteam:master Aug 4, 2015
@mshibuya
Copy link
Member

mshibuya commented Aug 4, 2015

Merging in, thanks!

@dwbutler
Copy link
Contributor Author

dwbutler commented Aug 6, 2015

@mshibuya Awesome, thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants