7 Roo.bootstrap.menu = Roo.bootstrap.menu || {};
10 * @class Roo.bootstrap.menu.Menu
11 * @extends Roo.bootstrap.Component
12 * Bootstrap Menu class - container for MenuItems
13 * @cfg {Boolean} submenu (true | false) default false
14 * @cfg {String} html Text of the menu
15 * @cfg {String} weight (default | primary | success | info | warning | danger | inverse)
19 * @param {Object} config The config object
23 Roo.bootstrap.menu.Menu = function(config){
24 Roo.bootstrap.menu.Menu.superclass.constructor.call(this, config);
28 // * @event beforeshow
29 // * Fires before this menu is displayed
30 // * @param {Roo.menu.Menu} this
34 // * @event beforehide
35 // * Fires before this menu is hidden
36 // * @param {Roo.menu.Menu} this
41 // * Fires after this menu is displayed
42 // * @param {Roo.menu.Menu} this
47 // * Fires after this menu is hidden
48 // * @param {Roo.menu.Menu} this
53 // * Fires when this menu is clicked (or when the enter key is pressed while it is active)
54 // * @param {Roo.menu.Menu} this
55 // * @param {Roo.menu.Item} menuItem The menu item that was clicked
56 // * @param {Roo.EventObject} e
61 // * Fires when the mouse is hovering over this menu
62 // * @param {Roo.menu.Menu} this
63 // * @param {Roo.EventObject} e
64 // * @param {Roo.menu.Item} menuItem The menu item that was clicked
69 // * Fires when the mouse exits this menu
70 // * @param {Roo.menu.Menu} this
71 // * @param {Roo.EventObject} e
72 // * @param {Roo.menu.Item} menuItem The menu item that was clicked
77 // * Fires when a menu item contained in this menu is clicked
78 // * @param {Roo.menu.BaseItem} baseItem The BaseItem that was clicked
79 // * @param {Roo.EventObject} e
86 Roo.extend(Roo.bootstrap.menu.Menu, Roo.bootstrap.Component, {
93 getChildContainer : function() {
94 return this.el.select('ul.dropdown-menu', true).first();
97 getAutoCreate : function()
105 cls : 'btn btn-' + this.weight,
110 cls : 'dropdown-toggle btn btn-' + this.weight,
120 cls : 'dropdown-menu'
129 initEvents : function() {
131 this.triggerEl = this.el.select('button.dropdown-toggle', true).first();
132 this.triggerEl.on('click', this.onTriggerPress, this);
136 onTriggerPress : function(e)
139 Roo.log('trigger press');
141 if (this.isVisible()) {
150 isVisible : function(){
157 this.el.addClass('open');
164 this.el.removeClass('open');;