Roo/bootstrap/Alert.js
authorAlan Knowles <alan@roojs.com>
Tue, 8 Jun 2021 08:01:15 +0000 (16:01 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 8 Jun 2021 08:01:15 +0000 (16:01 +0800)
Roo/bootstrap/Alert.js

index b4d09d4..0e2f8c1 100644 (file)
@@ -11,6 +11,7 @@
  * @cfg {String} html The content of alert
  * @cfg {String} weight (  success | info | warning | danger )
  * @cfg {String} fa font-awesomeicon
+   @cfg {Number} seconds default:-1 Number of seconds until it disapears (-1 means never.)
  * 
  * 
  * @constructor
@@ -74,27 +75,29 @@ Roo.extend(Roo.bootstrap.Alert, Roo.bootstrap.Component,  {
     initEvents: function() 
     {
         this.el.setVisibilityMode(Roo.Element.DISPLAY);
+        this.titleEl =  this.el.select('.roo-alert-title',true).first();
+        this.iconEl = this.el.select('.roo-alert-icon',true).first();
     },
     
     setTitle : function(str)
     {
-        this.el.select('.roo-alert-title',true).first().dom.innerHTML = str;
+        this.titleEl.dom.innerHTML = str;
     },
     
     setText : function(str)
     {
-        this.el.select('.roo-alert-text',true).first().dom.innerHTML = str;
+        this.titleEl.dom.innerHTML = str;
     },
     
     setWeight : function(weight)
     {
         if(this.weight){
-            this.el.select('.alert',true).first().removeClass('alert-' + this.weight);
+            this.el.removeClass('alert-' + this.weight);
         }
         
         this.weight = weight;
         
-        this.el.select('.alert',true).first().addClass('alert-' + this.weight);
+        this.el.addClass('alert-' + this.weight);
     },
     
     setIcon : function(icon)