django-multiselectfield icon indicating copy to clipboard operation
django-multiselectfield copied to clipboard

Sortable Multichoice field

Open kunalgrover05 opened this issue 7 years ago • 1 comments

I have modified the default form widget to enable sorting of data which is added into our DB. This PR makes this behavior default since I am not sure if there is any disadvantage of doing that.

This adds an extra dependency of JQuery UI library: https://jqueryui.com/ Possibly, any other simple JS library can replace the JQuery UI module.

Behavior

  • All list of items are sortable. Since there is no change in how the DB stuff is handled, only sorting of the selected items will be saved.
  • When the form is reloaded, all selected items show on top in sorted order, and unselected items go at bottom(in the same order they are defined).
  • When sorting is changed, the form is marked as dirty and saved again. This is a change from the current behavior.

PS: I am unsure of my sorting technique by overriding optgroups function. Any advise is welcome.

kunalgrover05 avatar Jul 07 '18 12:07 kunalgrover05

Hi, could you update from master?

tomasgarzon avatar Oct 04 '19 09:10 tomasgarzon