Skip to content
This repository
Browse code

BUGFIX fix the field generated by choser with 0 width in an iFrame popup

  • Loading branch information...
commit 7a27832297bb02b63930f5ace3af37488583a991 1 parent a95b11d
Normann Lou authored March 27, 2012 chillu committed March 27, 2012

Showing 1 changed file with 12 additions and 2 deletions. Show diff stats Hide diff stats

  1. 14  admin/javascript/LeftAndMain.js
14  admin/javascript/LeftAndMain.js
@@ -18,6 +18,16 @@ jQuery.noConflict();
18 18
 			spinner.show();
19 19
 		};
20 20
 		
  21
+		// apply an select element only when it is ready, ie. when it is rendered into a template
  22
+		// with css applied and got a width value.
  23
+		var applyChosen = function(el){
  24
+			if(el.outerWidth()){
  25
+				el.chosen().addClass("has-chzn");
  26
+			} else {
  27
+				setTimeout(function() {applyChosen(el);},500);
  28
+			}
  29
+		};
  30
+		
21 31
 		$(window).bind('resize', positionLoadingSpinner).trigger('resize');
22 32
 
23 33
 		// global ajax error handlers
@@ -456,8 +466,8 @@ jQuery.noConflict();
456 466
 				// Explicitly disable default placeholder if no custom one is defined
457 467
 				if(!this.data('placeholder')) this.data('placeholder', ' ');
458 468
 
459  
-				// Apply chosen
460  
-				this.chosen().addClass("has-chzn");
  469
+				// Apply Chosen
  470
+				applyChosen(this);
461 471
 				
462 472
 				this._super();
463 473
 			}

0 notes on commit 7a27832

Please sign in to comment.
Something went wrong with that request. Please try again.