summaryrefslogtreecommitdiffstats
path: root/jquery.multiple.select.js
diff options
context:
space:
mode:
author文翼 <wenzhixin2010@gmail.com>2014-07-24 07:39:23 +0800
committer文翼 <wenzhixin2010@gmail.com>2014-07-24 07:39:23 +0800
commit5ee9b6c6fd4d1b82b545b134a2dbf2af371cedf0 (patch)
tree54b0ea8421ad544427ad60bc52b60d772e0cf0e3 /jquery.multiple.select.js
parent1e19de75c83d8f2142613171ef110dbe76d1398c (diff)
parente411fabf2b3a3afb0ec7a79db95faa53d95903c8 (diff)
downloadmultiple-select-5ee9b6c6fd4d1b82b545b134a2dbf2af371cedf0.zip
multiple-select-5ee9b6c6fd4d1b82b545b134a2dbf2af371cedf0.tar.gz
multiple-select-5ee9b6c6fd4d1b82b545b134a2dbf2af371cedf0.tar.bz2
Merge pull request #116 from Smashman/master
Get percentage width, if used. Check select all if all elements selected on init.
Diffstat (limited to 'jquery.multiple.select.js')
-rw-r--r--jquery.multiple.select.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/jquery.multiple.select.js b/jquery.multiple.select.js
index de87c65..83a74d8 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')) {