summaryrefslogtreecommitdiffstats
path: root/jquery.multiple.select.js
diff options
context:
space:
mode:
authorzhixin <wenzhixin2010@gmail.com>2014-05-23 08:05:16 +0800
committerzhixin <wenzhixin2010@gmail.com>2014-05-23 08:05:16 +0800
commit4665c30a8b1f3a329a851a62455193202d027bbf (patch)
tree211dd617c41c46fa15eadfbc9332ba8578faf8d1 /jquery.multiple.select.js
parent24aae4cb5996b15c275492c87f23329889c84150 (diff)
downloadmultiple-select-4665c30a8b1f3a329a851a62455193202d027bbf.zip
multiple-select-4665c30a8b1f3a329a851a62455193202d027bbf.tar.gz
multiple-select-4665c30a8b1f3a329a851a62455193202d027bbf.tar.bz2
Fix #77: Says 'All selected' when no options in select box.
Diffstat (limited to 'jquery.multiple.select.js')
-rw-r--r--jquery.multiple.select.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/jquery.multiple.select.js b/jquery.multiple.select.js
index f6dfe4c..20387a0 100644
--- a/jquery.multiple.select.js
+++ b/jquery.multiple.select.js
@@ -79,6 +79,7 @@
html.push('<li class="ms-no-results">' + this.options.noMatchesFound + '</li>');
html.push('</ul>');
this.$drop.html(html.join(''));
+
this.$drop.find('ul').css('max-height', this.options.maxHeight + 'px');
this.$drop.find('.multiple').css('width', this.options.multipleWidth + 'px');
@@ -227,6 +228,12 @@
this.$selectAll.parent().show();
this.$noResults.hide();
+ // Fix #77: 'All selected' when no options
+ if (this.$el.children().length === 0) {
+ this.$selectAll.parent().hide();
+ this.$noResults.show();
+ }
+
if (this.options.container) {
var offset = this.$drop.offset();
this.$drop.appendTo($(this.options.container));
@@ -256,7 +263,8 @@
update: function() {
var selects = this.getSelects(),
$span = this.$choice.find('>span');
- if (selects.length === this.$selectItems.length + this.$disableItems.length && this.options.allSelected) {
+
+ if (selects.length && selects.length === this.$selectItems.length + this.$disableItems.length && this.options.allSelected) {
$span.removeClass('placeholder').html(this.options.allSelected);
} else if (selects.length > this.options.minumimCountSelected && this.options.countSelected) {
$span.removeClass('placeholder').html(this.options.countSelected