django-advanced-filters icon indicating copy to clipboard operation
django-advanced-filters copied to clipboard

initialize select2 widget

Open pjpassa opened this issue 9 years ago • 4 comments

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.

pjpassa avatar Aug 18 '16 18:08 pjpassa

Coverage Status

Coverage remained the same at 96.198% when pulling f37013c9ad45dcb1813b82dbb59bed99fb79e976 on worthwhile:feat/initialize-select2 into 119c76d7198b84148f5662face3e62af9241895b on modlinltd:develop.

coveralls avatar Aug 18 '16 18:08 coveralls

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).

asfaltboy avatar Aug 19 '16 07:08 asfaltboy

I just merged master into this branch locally and tested it out. Things seem to work as promised:

advanced_filters_pr_31

mrname avatar Jun 28 '18 19:06 mrname