-
Notifications
You must be signed in to change notification settings - Fork 354
Select2 - How to stop automatic sorting? #406
Comments
I stumble upon the same issue, and after some test I'm thinking it's actually an issue in select2, and not in angular-ui. When programmatically setting the select2 widget you can use select2.('val') or select2.('data'). The select2 directive seems to use select2.('val') for multiple select. A fix could be to change that to select2.('data'), but I had no success with it so far... |
It uses data if you pass an object instead of an idea. V0.4.0 may have some
|
Where could I find the most updated code for 0.4.0? I can't see any branch or tag with 0.4.0. |
I should probably start developing into a dedicated branch... |
I have been poking around with this and it makes 0 sense why this should be occurring as angular and angularUI is not actually doing anything specifically to deal with data order. I will slate this fix for v0.4.1 |
AngularUI is currently undergoing a restructure. This project will no longer hold the codebase, can you please relocate this to https://github.com/angular-ui/ui-select2 (after confirming it's still necessary with the latest code)? |
This repo is discontinued. The project has been relocated here: https://github.com/angular-ui/ui-select2 Please reopen this issue there if it is still relevant. |
I have the same problem of Select2 4.0.0 |
<script type="text/javascript">
$("select").select2({
tags: true
});
$("select").on("select2:select", function (evt) {
var element = evt.params.data.element;
var $element = $(element);
$element.detach();
$(this).append($element);
$(this).trigger("change");
});
</script>
I solved this problem :) |
tags: true $("select").on("select2:select", function (evt) { $element.detach(); |
Looks like when using
multiple
, the items are sorted automatically.Is there a way to stop this?
Live example here: http://plnkr.co/edit/5X7s8WZPVw7Z9gVWDjK3?p=preview
See also: http://stackoverflow.com/questions/14727502/angular-ui-select2-how-to-stop-automatic-sorting
The text was updated successfully, but these errors were encountered: