2016-06-28 3 views
1

私のxPageは、ユーザー名であるドロップダウン(basicContainerNode)を持っています。私はちょうどそのラベルの横にアイコンを追加したい。それをIMAGEプロパティに追加する必要があると仮定しますが、ラベルには追加しないでください。basicContainerNodeの隣にグリフコンを追加するには?

<xe:this.navbarUtilityLinks> 
    <xe:basicContainerNode> 
     <xe:this.label><![CDATA[#{javascript:var currentUserName:NotesName = session.createName(session.getEffectiveUserName()); 
     return "<span class='glyphicon glyphicon glyphicon-user' style='margin-right: 1em;'></span>" + currentUserName.getAbbreviated();}]]> 
     </xe:this.label> 

    <xe:this.children> 
     <xe:loginTreeNode rendered="false"></xe:loginTreeNode> 
     <xe:basicLeafNode title="Logout" submitValue="appLogout" label="Logout"></xe:basicLeafNode> 
    </xe:this.children> 
    </xe:basicContainerNode> 
</xe:this.navbarUtilityLinks> 

答えて

0

basicContainerNodeのラベルはプレーンテキストのみです。

あなたのラベルからスパン部分を削除し、あなたのXPageに次のイベントを追加します。

<xp:eventHandler 
    event="onClientLoad" 
    submit="false"> 
    <xp:this.script><![CDATA[dojo.query('.dropdown .dropdown-toggle').forEach(function(e){ 
     var spanNode = document.createElement("span");    
     spanNode.className = 'glyphicon glyphicon-user'; 
     spanNode.style.marginRight='1em'; 
     e.insertBefore(spanNode, e.firstChild); 
    })]]></xp:this.script> 
</xp:eventHandler> 

それは「クラス「ドロップダウン」+「ドロップダウン・トグル」を検索し、クラスとspan要素を挿入glyphicon glyphicon-user "とスタイル" margin-right:1em "を指定します。

enter image description here

ユーザー名の前に、ユーザーのアイコンを取得この方法:

enter image description here

+0

@VladP:あなたはそれが仕事を得ることができますか? –

関連する問題