X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=docs%2Fsrc%2FRoo_bootstrap_Menu.js.html;h=4d1dfeb9112fb8e12ef27e0b08e382bf9cc808ac;hp=69fbb6aa4e4107e9aec5729faca5fceecdfa3463;hb=c3fae677247c171d616820f63a06609c27abacb3;hpb=fe420d2446bbf077df23ab1ce3159fe2cd786415
diff --git a/docs/src/Roo_bootstrap_Menu.js.html b/docs/src/Roo_bootstrap_Menu.js.html
index 69fbb6aa4e..4d1dfeb911 100644
--- a/docs/src/Roo_bootstrap_Menu.js.html
+++ b/docs/src/Roo_bootstrap_Menu.js.html
@@ -13,8 +13,9 @@
* @cfg {bool} hidden if the menu should be hidden when rendered.
* @cfg {bool} stopEvent (true|false) Stop event after trigger press (default true)
* @cfg {bool} isLink (true|false) the menu has link disable auto expand and collaspe (default false)
- * @cfg {bool} hideTrigger (true|false) default false - hide the carret for trigger.
- *
+ * @cfg {bool} hideTrigger (true|false) default false - hide the carret for trigger.
+ * @cfg {String} align default tl-bl? == below - how the menu should be aligned.
+
* @constructor
* Create a new Menu
* @param {Object} config The config object
@@ -91,7 +92,7 @@
Roo.extend(Roo.bootstrap.Menu, Roo.bootstrap.Component, {
triggerEl : false, type: false,
hideTrigger : false,
+ align : 'tl-bl?',
+
getChildContainer : function() {
return this.el;
@@ -124,7 +127,6 @@
// cfg.cn[1].cls += ' pull-right'
//}
-
var cfg = {
tag : 'ul',
cls : 'dropdown-menu shadow' ,
@@ -275,8 +277,31 @@
if(!this.el){
this.render();
}
+ this.el.addClass('show'); var xy = this.el.getAlignToXY(el, pos);
+
+ if(this.el.getWidth() + xy[0] >= Roo.lib.Dom.getViewWidth()){
+ xy = this.el.getAlignToXY(el, this.align.replace('/l/g', 'r'))
+ }
+ if(xy[0] < 0){
+ xy = this.el.getAlignToXY(el, this.align.replace('/r/g', 'l'))
+ }
- this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign), parentMenu, false);
+ if(this.el.getHeight() + xy[1] >= Roo.lib.Dom.getViewHeight() ||
+ xy[1] < 0 ){
+ var a = this.align.replace('?', '').split('-');
+ xy = this.el.getAlignToXY(el, a[1] + '-' + a[0] + '?')
+
+ }
+
+ this.showAt( xy , parentMenu, false);
},
this.triggerEl.addClass('open');
this.el.addClass('show');
+
+
if(this.el.getWidth() + xy[0] >= Roo.lib.Dom.getViewWidth()){
- xy[0] = xy[0] - this.el.getWidth() + this.triggerEl.getWidth();
- }
- if(this.el.getHeight() + xy[1] >= Roo.lib.Dom.getViewHeight()){
- xy[1] = xy[1] - this.el.getHeight() - this.triggerEl.getHeight();
- }
+ // reassign y when hitting bottom
- if(this.el.getStyle('top') != 'auto' && this.el.getStyle('top').slice(-1) != "%"){
this.el.setXY(xy);
@@ -395,7 +416,8 @@
this.hide();
} else {
Roo.log('show');
- this.show(this.triggerEl, '?', false);
+
+ this.show(this.triggerEl, this.align, false);
}
if(this.stopEvent || e.getTarget().nodeName.toLowerCase() === 'i'){