9 * @class Roo.bootstrap.MessageBar
10 * @extends Roo.bootstrap.Component
11 * Bootstrap MessageBar class
12 * @cfg {String} html contents of the MessageBar
13 * @cfg {String} weight (info | success | warning | danger) default info
14 * @cfg {String} beforeClass insert the bar before the given class
15 * @cfg {Boolean} closable (true | false) default false
16 * @cfg {Boolean} fixed (true | false) default false, fix the bar at the top
19 * Create a new Element
20 * @param {Object} config The config object
23 Roo.bootstrap.MessageBar = function(config){
24 Roo.bootstrap.MessageBar.superclass.constructor.call(this, config);
27 Roo.extend(Roo.bootstrap.MessageBar, Roo.bootstrap.Component, {
33 beforeClass: 'bootstrap-sticky-wrap',
35 getAutoCreate : function(){
39 cls: 'alert alert-dismissable alert-' + this.weight,
50 cfg.cls += ' alert-messages-fixed';
64 onRender : function(ct, position)
66 Roo.bootstrap.Component.superclass.onRender.call(this, ct, position);
69 var cfg = Roo.apply({}, this.getAutoCreate());
73 cfg.cls += ' ' + this.cls;
76 cfg.style = this.style;
78 this.el = Roo.get(document.body).createChild(cfg, Roo.select('.'+this.beforeClass, true).first());
80 this.el.setVisibilityMode(Roo.Element.DISPLAY);
83 this.el.select('>button.close').on('click', this.hide, this);
95 this.fireEvent('show', this);
101 if (!this.rendered) {
107 this.fireEvent('hide', this);
112 // var e = this.el.dom.firstChild;
114 // if(this.closable){
115 // e = e.nextSibling;
118 // e.data = this.html || '';
120 this.el.select('>.message', true).first().dom.innerHTML = this.html || '';