Skip to content

Commit

Permalink
fix a bug where multiselect would not select values with non-ASCII ch…
Browse files Browse the repository at this point in the history
…aracters.
  • Loading branch information
bbenezech committed Nov 14, 2012
1 parent 2e583be commit ed1c428
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions app/assets/javascripts/rails_admin/ra.filtering-multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
/* Add to selection */
this.add.click(function(e){
widget._select($(':selected', widget.collection));

e.preventDefault();
widget.selection.trigger('change');
});
Expand Down Expand Up @@ -183,7 +184,7 @@
_deSelect: function(options) {
var widget = this;
options.each(function(i, option) {
widget.element.find("option[value=" + option.value + "]").removeAttr("selected");
widget.element.find('option[value="' + option.value + '"]').removeAttr("selected");
});
$(options).appendTo(this.collection).attr('selected', false);
},
Expand Down Expand Up @@ -235,7 +236,7 @@
_select: function(options) {
var widget = this;
options.each(function(i, option) {
var el = widget.element.find("option[value=" + option.value + "]");
var el = widget.element.find('option[value="' + option.value + '"]');
if (el.length) {
el.attr("selected", "selected");
} else {
Expand All @@ -251,8 +252,8 @@
options.each(function(i, option) {
var prev = $(option).prev();
if (prev.length > 0) {
var el = widget.element.find("option[value=" + option.value + "]");
var el_prev = widget.element.find("option[value=" + prev[0].value + "]");
var el = widget.element.find('option[value="' + option.value + '"]');
var el_prev = widget.element.find('option[value="' + prev[0].value + '"]');
el_prev.before(el);
prev.before($(option));
}
Expand All @@ -262,8 +263,8 @@
options.reverse().each(function(i, option) {
var next = $(option).next();
if (next.length > 0) {
var el = widget.element.find("option[value=" + option.value + "]");
var el_next = widget.element.find("option[value=" + next[0].value + "]");
var el = widget.element.find('option[value="' + option.value + '"]');
var el_next = widget.element.find('option[value="' + next[0].value + '"]');
el_next.after(el);
next.after($(option));
}
Expand All @@ -272,7 +273,7 @@
},

selected: function(value) {
return this.element.find("option[value=" + value + "]").attr("selected");
return this.element.find('option[value="' + value + '"]').attr("selected");
},

destroy: function() {
Expand Down

0 comments on commit ed1c428

Please sign in to comment.