1
0
mirror of synced 2024-11-26 14:56:07 +03:00

fix tracking of results under mouse. fixes #258

This commit is contained in:
Igor Vaynberg 2012-07-25 00:55:53 +03:00
parent e620b54271
commit b3089218dc

View File

@ -1891,20 +1891,29 @@
postprocessResults: function () { postprocessResults: function () {
var val = this.getVal(), var val = this.getVal(),
choices = this.results.find(".select2-result-selectable"), choices = this.results.find(".select2-result-selectable"),
compound = this.results.find(".select2-result-with-children"),
self = this; self = this;
choices.each2(function (i, choice) { choices.each2(function (i, choice) {
var id = self.id(choice.data("select2-data")); var id = self.id(choice.data("select2-data"));
if (indexOf(id, val) >= 0) { if (indexOf(id, val) >= 0) {
choice.addClass("select2-disabled"); choice.addClass("select2-disabled").removeClass("select2-result-selectable");
} else { } else {
choice.removeClass("select2-disabled"); choice.removeClass("select2-disabled").addClass("select2-result-selectable");
}
});
compound.each2(function(i, e) {
if (e.find(".select2-result-selectable").length==0) {
e.addClass("select2-disabled");
} else {
e.removeClass("select2-disabled");
} }
}); });
choices.each2(function (i, choice) { choices.each2(function (i, choice) {
if (!choice.hasClass("select2-disabled")) { if (!choice.hasClass("select2-disabled") && choice.hasClass("select2-result-selectable")) {
self.highlight(i); self.highlight(0);
return false; return false;
} }
}); });