Browse files

The slide toggle works by waiting to create the object if it is set t…

…o hidden. If the multiselect is never toggled then we don't have to create it. After it is created we just do a normal toggle. This seems to allow drag and drop functionality to work as well as other issues that seem to occur if we try to create it hidden.
  • Loading branch information...
1 parent 92977c8 commit 88a9c5814d912adfed2ee8bdacbff49352c07947 @ejhayes ejhayes committed Sep 1, 2010
Showing with 11 additions and 5 deletions.
  1. +11 −5 js/ui.multiselect.js
View
16 js/ui.multiselect.js
@@ -93,9 +93,11 @@ $.widget("ui.multiselect", {
// callbacks
dataParser: defaultDataParser,
nodeComparator: defaultNodeComparator,
- nodeInserted: null
+ nodeInserted: null,
+ hidden: false
},
_create: function() {
+ if( !this.options.hidden){
this.element.hide();
this.busy = false; // busy state
this.container = $('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);
@@ -151,17 +153,21 @@ $.widget("ui.multiselect", {
// init lists
this._populateLists(this.element.find('option'));
+ } // end check for hidden attribute
},
/**************************************
* Public
**************************************/
slideToggle: function() {
- this.container.slideToggle();
-
- // since we don't know this yet
- this.availableActions.find('input').width(Math.max(this.availableActions.width() - this.availableActions.find('a.add-all').width() - 30, 20));
+ if( this.options.hidden ){
+ this.options.hidden = !this.options.hidden; // this should no longer be hidden
+ this._create(); // now create it
+ }
+ else{
+ this.container.slideToggle(); // otherwise just toggle it
+ }
},

0 comments on commit 88a9c58

Please sign in to comment.