From: Alan Knowles Date: Fri, 7 May 2021 08:17:33 +0000 (+0800) Subject: Changed Roo/bootstrap/NavItem.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=4be99a992f53aa016c97c0d7daf7762f1a3f0cc5 Changed Roo/bootstrap/NavItem.js --- diff --git a/Roo/bootstrap/NavItem.js b/Roo/bootstrap/NavItem.js index 9f7b149e18..e0ef5f64fc 100644 --- a/Roo/bootstrap/NavItem.js +++ b/Roo/bootstrap/NavItem.js @@ -107,8 +107,10 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component, { cfg.href = this.href; } if (this.fa) { - cfg.html = ' ' + this.html + ''; - } + cfg.html = ' ' + this.html + ''; + } else { + cfg.cls += " nav-html"; + } // menu .. should add dropdown-menu class - so no need for carat.. @@ -124,7 +126,8 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component, { { tag: this.tagtype, href : this.href || "#", - html: this.html || '' + html: this.html || '', + cls : '' } ]; if (this.tagtype == 'a') { @@ -132,23 +135,21 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component, { } if (this.icon) { - cfg.cn[0].html = ' ' + cfg.cn[0].html + ''; - } - if (this.fa) { - cfg.cn[0].html = ' ' + cfg.cn[0].html + ''; - } - if(this.glyphicon) { + cfg.cn[0].html = ' ' + cfg.cn[0].html + ''; + } else if (this.fa) { + cfg.cn[0].html = ' ' + cfg.cn[0].html + ''; + } else if(this.glyphicon) { cfg.cn[0].html = ' ' + cfg.cn[0].html; - } + } else { + cfg.cn[0].cls += " nav-html"; + } if (this.menu) { - cfg.cn[0].html += " "; } if (this.badge !== '') { - cfg.cn[0].html += ' ' + this.badge + ''; } } @@ -166,6 +167,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',true).first(); + this.htmlEl = this.el.select('.nav-html',true).first(); return ret; }, @@ -363,7 +365,16 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component, { Roo.get(c).scrollTo('top', options.value, true); return; - } + }, + /** + * Set the HTML (text content) of the item + * @param {string} html content for the nav item + */ + setHtml : function(html) + { + this.htmlEl.dom.innerHTML = html; + + } });