Open pjpassa opened 8 years ago
Hi @pjpassa, thanks again for putting work on the project.
Please see my comments on commit b48dfe8fb9d267be918dd0d272785ed581260509. Generally speaking this seems like the right place to resolve this issue.
Unfortunately, I won't have time to test any time soon, and we still don't have a frontend test suite (issue #19).
I just merged master into this branch locally and tested it out. Things seem to work as promised:
This merge request allows the select2 widget to pre-populate with the current value. It should also fix Issue 22.
There is a side effect to how I fixed this, which I think is OK. If the value is not in the list returned by the ajax call it is added to the beginning of the list. This does also make it easy to switch back to the old value if you want to.
Also, if the value is in the list returned from the ajax call, it is in the list twice. This behavior is less desired, but it can be useful if you have a long list to see what the previous value was.