Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Commit

Permalink
Merge pull request #181 from homerjam/sortable
Browse files Browse the repository at this point in the history
Add sortable option
  • Loading branch information
ProLoser committed Aug 1, 2014
2 parents 5482d8f + 6f09293 commit 2781639
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/select2.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@ angular.module('ui.select2', []).value('uiSelect2Config', {}).directive('uiSelec
}
elm.select2(
'data', convertToSelect2Model(viewValue));
if (opts.sortable) {
elm.select2("container").find("ul.select2-choices").sortable({
containment: 'parent',
start: function () {
elm.select2("onSortStart");
},
update: function () {
elm.select2("onSortEnd");
elm.trigger('change');
}
});
}
} else {
if (angular.isObject(controller.$viewValue)) {
elm.select2('data', controller.$viewValue);
Expand Down

0 comments on commit 2781639

Please sign in to comment.