if (this.registerMenu && this.type != 'treeview') {
Roo.bootstrap.MenuMgr.register(this);
}
+
+
this.addEvents({
/**
* @event beforeshow
this.triggerEl.on(Roo.isTouch ? 'touchstart' : 'mouseup', this.onTriggerPress, this);
- this.triggerEl.addClass('dropdown-toggle');
-
+
+ if (this.triggerEl.hasClass('nav-item')) {
+ // dropdown toggle on the 'a' in BS4?
+ this.triggerEl.select('.nav-link',true).first().addClass('dropdown-toggle');
+ } else {
+ this.triggerEl.addClass('dropdown-toggle');
+ }
if (Roo.isTouch) {
this.el.on('touchstart' , this.onTouch, this);
}
this.render();
}
this.fireEvent("beforeshow", this);
-
- Roo.log('EL----------------');
- Roo.log(el);
-
-
this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign), parentMenu, false);
},
/**
this.hideMenuItems();
this.hidden = false;
this.triggerEl.addClass('open');
+ this.el.addClass('show');
- if(this.el.getWidth() + xy[0] > Roo.lib.Dom.getViewWidth()){
+ // reassign x when hitting right
+ if(this.el.getWidth() + xy[0] >= Roo.lib.Dom.getViewWidth()){
xy[0] = xy[0] - this.el.getWidth() + this.triggerEl.getWidth();
}
+ // reassign y when hitting bottom
+ if(this.el.getHeight() + xy[1] >= Roo.lib.Dom.getViewHeight()){
+ xy[1] = xy[1] - this.el.getHeight() - this.triggerEl.getHeight();
+ }
+
+ // but the list may align on trigger left or trigger top... should it be a properity?
+
if(this.el.getStyle('top') != 'auto' && this.el.getStyle('top').slice(-1) != "%"){
this.el.setXY(xy);
}
this.activeItem = null;
}
this.triggerEl.removeClass('open');;
+ this.el.removeClass('show');
this.hidden = true;
this.fireEvent("hide", this);
}
this.hide();
} else {
Roo.log('show');
- this.show(this.triggerEl, false, false);
+ this.show(this.triggerEl, '?', false);
}
if(this.stopEvent || e.getTarget().nodeName.toLowerCase() === 'i'){