Roo/bootstrap/NavItem.js
[roojs1] / Roo / bootstrap / NavItem.js
index c5cec6d..cdbd66f 100644 (file)
@@ -10,6 +10,8 @@
  * @extends Roo.bootstrap.Component
  * Bootstrap Navbar.NavItem class
  * @cfg {String} href  link to
+ * @cfg {String} button_weight (default | primary | secondary | success | info | warning | danger | link ) default none
+
  * @cfg {String} html content of button
  * @cfg {String} badge text inside badge
  * @cfg {String} badgecls (bg-green|bg-red|bg-yellow)the extra classes for the badge
@@ -75,6 +77,8 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component,  {
     disabled : false,
     animateRef : false,
     was_active : false,
+    button_weight : '',
+    button_outline : false,
     
     navLink: false,
     
@@ -83,7 +87,6 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component,  {
         var cfg = {
             tag: this.tag,
             cls: 'nav-item'
-            
         };
         
         if (this.active) {
@@ -92,6 +95,18 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component,  {
         if (this.disabled) {
             cfg.cls += ' disabled';
         }
+       
+       if (this.button_weight.length) {
+           cfg.tag = this.href ? 'a' : 'button';
+           cfg.html = this.html || '';
+           cfg.cls += ' btn' + (this.btn_outline ? '-outline' : '') + this.button_weight;
+           if (this.href) {
+               
+           }
+           
+           
+           
+       }
         
         if (this.href || this.html || this.glyphicon || this.icon || this.fa) {
             cfg.cn = [
@@ -138,7 +153,7 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component,  {
        }
        
         var ret = Roo.bootstrap.NavItem.superclass.onRender.call(this, ct, position);
-       this.navLink = this.el.select('nav-link').first();
+       this.navLink = this.el.select('.nav-link',true).first();
        return ret;
     },
       
@@ -248,8 +263,8 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component,  {
         } else if (!this.el.hasClass('active')) {
            
             this.el.addClass('active');
-           if (Roo.bootstrap.version == 4) {
-               this.navLink ? this.navLink.addClass('active') : false;
+           if (Roo.bootstrap.version == 4 && this.navLink ) {
+               this.navLink.addClass('active');
            }
            
         }