maskEl : false, // the mask element
headerEl : false,
contentEl : false,
-
+ alignEl : false, // when show is called with an element - this get's stored.
getChildContainer : function()
{
* @param {Roo.Element|string|Boolean} - element to align and point to. (set align to [ pos, offset ])
* @param {string} (left|right|top|bottom) position
*/
- show : function (on_el)
+ show : function (on_el, placement)
{
-
+ this.placement = typeof(placement) == 'undefined' ? this.placement : placement;
on_el = on_el || false; // default to false
- var align = on_el && typeof(on_el._align) != 'undefined' ? on_el._align : false;
-
+
if (!on_el) {
if (this.parent() && (this.over == 'parent' || (this.over === false))) {
on_el = this.parent().el;
this.headerEl.hide();
}
-
- var placement = typeof this.placement == 'function' ?
- this.placement.call(this, this.el, on_el) :
- this.placement;
-
- /*
- 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.alignment = align || Roo.bootstrap.Popover.alignment[placement];
- this.el.addClass(this.alignment[2]);
-
-// Roo.log(align);
+ this.el.addClass(placement + ' roo-popover-' + placement);
if (on_el) {
- this.alignEl = on_el;
this.updatePosition();
} else {
* fire this manually after loading a grid in the table for example
*
*/
- 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;
+ }
+
+ 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);
+
+ }
+
+
}
- this.el.alignTo(this.alignEl , this.alignment[0],this.alignment[1]);
+
+
// work out the pointy position.
var p1 = this.alignment[0].split('-').pop().replace('?','');