Skip to content

Commit

Permalink
Fix for issue crlcu#58 - Using optgroups breaks keepRenderingSort
Browse files Browse the repository at this point in the history
  • Loading branch information
crlcu committed Jun 7, 2016
1 parent 97dbf46 commit 9a47caa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions js/multiselect.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @license
*
* Multiselect v2.2.6
* Multiselect v2.2.7
* http://crlcu.github.io/multiselect/
*
* Copyright (c) 2015 Adrian Crisan
Expand Down Expand Up @@ -92,9 +92,11 @@ if (typeof jQuery === 'undefined') {
if (self.options.keepRenderingSort) {
self.skipInitSort = true;

self.callbacks.sort = function(a, b) {
return $(a).data('position') > $(b).data('position') ? 1 : -1;
};
if (self.callbacks.sort !== false) {
self.callbacks.sort = function(a, b) {
return $(a).data('position') > $(b).data('position') ? 1 : -1;
};
}

self.$left.find('option').each(function(index, option) {
$(option).data('position', index);
Expand Down
4 changes: 2 additions & 2 deletions js/multiselect.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9a47caa

Please sign in to comment.