-
Notifications
You must be signed in to change notification settings - Fork 467
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
DAL is re-ordering items with the ModelSelect2Multiple widget #1357
Comments
Here is some code if it helps:
|
I developed a slight workaround. I deleted the object for the value (that gets created when you initially add it to the form) when I remove the item from that form. So in the case above, I select the element via $('#food') and I then delete the for each individual food that gets added when I select the food from that form element when I click 'x' in the form for that option. |
I have just noticed something interesting with DAL if you are using the ModelSelect2Multiple widget for the forms.ModelMultipleChoiceField. I initially selected apricot, then apples:
I then deleted both and then selected apples, then apricot:
However, once I selected apricot, the options selected above are re-ordered to apricot, then apples:
In other words, they are re-ordered to the original order in image 1. It appears that there is something in the background that is preserving the original order and ordering the items here based on that. I do not want that and I want to preserve the order of the currently selected items regardless. Is that possible?
The text was updated successfully, but these errors were encountered: