summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jquery.multiple.select.js16
-rw-r--r--multiple-select.css1
2 files changed, 12 insertions, 5 deletions
diff --git a/jquery.multiple.select.js b/jquery.multiple.select.js
index 47ab716..c55fa32 100644
--- a/jquery.multiple.select.js
+++ b/jquery.multiple.select.js
@@ -11,8 +11,12 @@
function MultipleSelect($el, options) {
var that = this,
- name = $el.attr('name') || options.name || '',
- elWidth = $el.outerWidth();
+ name = $el.attr('name') || options.name || ''
+
+ $el.parent().hide();
+ var elWidth = $el.css("width");
+ $el.parent().show();
+ if (elWidth=="0px") {elWidth = $el.outerWidth()+20}
this.$el = $el.hide();
this.options = options;
@@ -93,6 +97,7 @@
this.$disableItems = this.$drop.find('input[' + this.selectItemName + ']:disabled');
this.$noResults = this.$drop.find('.ms-no-results');
this.events();
+ this.updateSelectAll(true);
this.update(true);
if (this.options.isOpen) {
@@ -343,8 +348,9 @@
}
},
- updateSelectAll: function () {
- var $items = this.$selectItems.filter(':visible');
+ updateSelectAll: function (Init) {
+ var $items = this.$selectItems;
+ if (!Init) { $items = $items.filter(':visible'); }
this.$selectAll.prop('checked', $items.length &&
$items.length === $items.filter(':checked').length);
if (this.$selectAll.prop('checked')) {
@@ -368,7 +374,7 @@
texts = [],
values = [];
this.$drop.find('input[' + this.selectItemName + ']:checked').each(function () {
- texts.push($(this).parent().text());
+ texts.push($(this).parents('li').first().text());
values.push($(this).val());
});
diff --git a/multiple-select.css b/multiple-select.css
index 628a39c..4aeb323 100644
--- a/multiple-select.css
+++ b/multiple-select.css
@@ -175,6 +175,7 @@
.ms-drop ul > li label {
font-weight: normal;
display: block;
+ white-space: nowrap;
}
.ms-drop ul > li label.optgroup {