2 * @class Roo.bootstrap.Alert
3 * @extends Roo.bootstrap.Component
4 * Bootstrap Alert class - shows an alert area box
6 * <div class="alert alert-danger" role="alert"><span class="fa fa-exclamation-triangle"></span><span class="sr-only">Error:</span>
7 Enter a valid email address
10 * @cfg {String} title The title of alert
11 * @cfg {String} html The content of alert
12 * @cfg {String} weight ( success | info | warning | danger )
13 * @cfg {String} faicon font-awesomeicon
17 * @param {Object} config The config object
21 Roo.bootstrap.Alert = function(config){
22 Roo.bootstrap.Alert.superclass.constructor.call(this, config);
26 Roo.extend(Roo.bootstrap.Alert, Roo.bootstrap.Component, {
33 getAutoCreate : function()
42 cls : 'roo-alert-icon'
47 cls : 'roo-alert-title',
52 cls : 'roo-alert-text',
59 cfg.cn[0].cls += ' fa ' + this.faicon;
63 cfg.cls += ' alert-' + this.weight;
69 initEvents: function()
71 this.el.setVisibilityMode(Roo.Element.DISPLAY);
74 setTitle : function(str)
76 this.el.select('.roo-alert-title',true).first().dom.innerHTML = str;
79 setText : function(str)
81 this.el.select('.roo-alert-text',true).first().dom.innerHTML = str;
84 setWeight : function(weight)
87 this.el.select('.alert',true).first().removeClass('alert-' + this.weight);
92 this.el.select('.alert',true).first().addClass('alert-' + this.weight);
95 setIcon : function(icon)
98 this.el.select('.roo-alert-icon',true).first().removeClass(['fa', 'fa-' + this.faicon]);
103 this.el.select('.roo-alert-icon',true).first().addClass(['fa', 'fa-' + this.faicon]);