Skip to content

Commit

Permalink
Fix multiple values and default options
Browse files Browse the repository at this point in the history
  • Loading branch information
matrozov committed May 2, 2017
1 parent 1e58b5a commit 479d069
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 69 deletions.
44 changes: 22 additions & 22 deletions dist/js/selectopus.full.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,27 +101,6 @@
values: []
};

self.$element.find('option').each(function() {
var $option = $(this);

var value = $option.prop('value');

if (typeof(value) === 'undefined') {
value = $option.text();
}

result.items[value] = $option.text();

if ($option.prop('selected')) {
if (result.multiple) {
result.values.push(value);
}
else {
result.values = [value];
}
}
});

var language = $element.attr('lang');

if (self.language.exists(language)) {
Expand Down Expand Up @@ -175,6 +154,27 @@
}
});

self.$element.find('option').each(function() {
var $option = $(this);

var value = $option.prop('value');

if (typeof(value) === 'undefined') {
value = $option.text();
}

result.items[value] = $option.text();

if ($option.prop('selected')) {
if (result.multiple) {
result.values.push(value);
}
else {
result.values = [value];
}
}
});

return result;
},

Expand Down Expand Up @@ -718,7 +718,7 @@

required: false, // Allow empty value
multiple: false, // Allow multiple select
allowCreate: true, // Allow create new value
allowCreate: false, // Allow create new value

popupHideSelected: false, // Hide selected items (or only hightlite by default)

Expand Down
2 changes: 1 addition & 1 deletion dist/js/selectopus.full.min.js

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions dist/js/selectopus.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,27 +101,6 @@
values: []
};

self.$element.find('option').each(function() {
var $option = $(this);

var value = $option.prop('value');

if (typeof(value) === 'undefined') {
value = $option.text();
}

result.items[value] = $option.text();

if ($option.prop('selected')) {
if (result.multiple) {
result.values.push(value);
}
else {
result.values = [value];
}
}
});

var language = $element.attr('lang');

if (self.language.exists(language)) {
Expand Down Expand Up @@ -175,6 +154,27 @@
}
});

self.$element.find('option').each(function() {
var $option = $(this);

var value = $option.prop('value');

if (typeof(value) === 'undefined') {
value = $option.text();
}

result.items[value] = $option.text();

if ($option.prop('selected')) {
if (result.multiple) {
result.values.push(value);
}
else {
result.values = [value];
}
}
});

return result;
},

Expand Down Expand Up @@ -718,7 +718,7 @@

required: false, // Allow empty value
multiple: false, // Allow multiple select
allowCreate: true, // Allow create new value
allowCreate: false, // Allow create new value

popupHideSelected: false, // Hide selected items (or only hightlite by default)

Expand Down
Loading

0 comments on commit 479d069

Please sign in to comment.