You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, I have got a quite complex interface with some simple select2 and in some cases up to 20/30 select2 + select2Sortable that use select2 formatSelection function.
In this case i prefer to bind the select2SortableOrder on jQuery UI stop and on original select change.
Sorting 300 items of a single select2Sortable instance takes around 100 milliseconds on my hardware while sorting 20/30 instances on form submit will take 2/3 seconds...
I prefer a lot of little sorts instead of a big one but this is questionable.
Maybe the best way would be choose a default and add a parameter to let the developer change the default behaviour (bind: sortableStop|formSubmit). No time to develop this now :(.
I spotted a bug using select2 formatSelection function. In select2Sortable there's a weak text comparison between the original option text and the visualized li.select2-search-choice text to sort the original select option. This will fail if you format li.select2-search-choice content trough select2 formatSelection function so I change that option text comparison with an option value comparison.
At the end of select2SortableOrder there are a call to select2SortableDestroy() followeb by a call to select2Sortable() that don't take in consideration the new and optional sortableOptions argument passed on select2Sortable initilization. It seems it works fine commenting that 2 functions calls but I'm not sure removing them will not lead to other problems I didn't spotted yet.
Hoping my english will be understandable, your opinion will be very appreciated.
P.S.: Have you ever tried select2Sortable on a select2 ajax configured?
The text was updated successfully, but these errors were encountered:
Hi Ayub,
bindOrder is a very usefull option and I'm glad that you already deleted select2SortableDestroy() and select2Sortable().
I will open a pull request now with my code so you can look at the option value comparison.
When I talked about the select2 ajax configured I meant using ajax to retrieve select2 option.
Anyway I will test this as soon as possible :).
First of all, I have got a quite complex interface with some simple select2 and in some cases up to 20/30 select2 + select2Sortable that use select2 formatSelection function.
In this case i prefer to bind the select2SortableOrder on jQuery UI stop and on original select change.
Sorting 300 items of a single select2Sortable instance takes around 100 milliseconds on my hardware while sorting 20/30 instances on form submit will take 2/3 seconds...
I prefer a lot of little sorts instead of a big one but this is questionable.
Maybe the best way would be choose a default and add a parameter to let the developer change the default behaviour (bind: sortableStop|formSubmit). No time to develop this now :(.
I spotted a bug using select2 formatSelection function. In select2Sortable there's a weak text comparison between the original option text and the visualized li.select2-search-choice text to sort the original select option. This will fail if you format li.select2-search-choice content trough select2 formatSelection function so I change that option text comparison with an option value comparison.
At the end of select2SortableOrder there are a call to select2SortableDestroy() followeb by a call to select2Sortable() that don't take in consideration the new and optional sortableOptions argument passed on select2Sortable initilization. It seems it works fine commenting that 2 functions calls but I'm not sure removing them will not lead to other problems I didn't spotted yet.
Hoping my english will be understandable, your opinion will be very appreciated.
P.S.: Have you ever tried select2Sortable on a select2 ajax configured?
The text was updated successfully, but these errors were encountered: