Roo/bootstrap/Popover.js
[roojs1] / roojs-bootstrap-debug.js
index 5a8472b..1f91028 100644 (file)
@@ -19891,29 +19891,10 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
             this.headerEl.hide();
         }
         
-        // why make it so complicated... - we used to support functional calls for this .. why ?
-        
-            
-        /*
-        var autoToken = /\s?auto?\s?/i;   /// not sure how this was supposed to work? right auto ? what?
-        
-        // I think  'auto right' - but 
-        
-        var autoPlace = autoToken.test(placement);
-        if (autoPlace) {
-            placement = placement.replace(autoToken, '') || 'top';
-        }
-        */
-        
-        
+       
         this.el.show();
-        this.el.dom.style.display='block';
-        
-        //this.el.appendTo(on_el);
-        
-        var p = this.getPosition();
-        var box = this.el.getBox();
-        
+        this.el.dom.style.display = 'block';
+         
         
         this.el.addClass(placement + ' roo-popover-' + placement);
 
@@ -19952,14 +19933,32 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
     },
     /**
      * fire this manually after loading a grid in the table for example
-     *
+     * @param {string} (left|right|top|bottom) where to try and put it
+     * @param {Boolean} try and move it if we cant get right position.
      */
-    updatePosition : function()
+    updatePosition : function(placement, try_move)
     {
-        if (!this.alignEl || !this.alignment) {
-            return;
+        this.el.addClass(placement + ' roo-popover-' + placement);
+        
+        if (!this.alignEl ) {
+            return false;
         }
-        this.el.alignTo(this.alignEl , this.alignment[0],this.alignment[1]);
+        
+        switch (placement) {
+            case 'right':
+                var exact = this.el.getAlignToXY(this.alignEl, 'tl-tr', [10,0]);
+                var offset = this.el.getAlignToXY(this.alignEl, 'tl-tr?',[10,0]);
+                if (exact.equals(offset)) {
+                    //normal display...
+                    this.setXY(exact, this.preanim(arguments, 3));
+                    var xy = this.alignEl.getAnchorXY(p1, false);
+                    
+                }
+                
+                
+        }
+        
+        
         
         // work out the pointy position.
         var p1 = this.alignment[0].split('-').pop().replace('?','');