2014-01-27 59 views
0

我是Apache OFBiz的新手,並且想要自定義一些表單,我有以下代碼,並且我想僅顯示當前用戶記錄和其他用戶記錄的超鏈接當前用戶不應該看到超鏈接,而只是看到文本。Apache OFBiz爲用戶啓用/禁用超鏈接

<form name="ListEmplPositions" type="list" separate-columns="true" default-entity-name="EmplPosition" list-name="listIt" paginate-target="FindEmplPositions" paginate="true" 
    odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar"> 
    <actions> 
     <service service-name="performFind" result-map="result" result-map-list="listIt"> 
      <field-map field-name="inputFields" from-field="parameters"/> 
      <field-map field-name="entityName" value="EmplPosition"/> 
      <field-map field-name="orderBy" value="emplPositionId"/> 
      <field-map field-name="viewIndex" from-field="viewIndex"/> 
      <field-map field-name="viewSize" from-field="viewSize"/> 
     </service> 
    </actions> 
    <auto-fields-entity entity-name="EmplPosition" default-field-type="display"/> 
    <field use-when="emplPositionId==userLogin.partyId" name="emplPositionId" title="${uiLabelMap.HumanResEmployeePositionId}" widget-style="linktext"> 
     <hyperlink also-hidden="false" description="${emplPositionId}" target="emplPositionView"> 
      <parameter param-name="emplPositionId"/> 
     </hyperlink> 
    </field> 
</form> 

我想超鏈接在字段「empPositionId」的最後一行中,只對當前用戶記錄啓用。我試圖使用和其他條件,但它沒有奏效,任何想法做它,你的幫助將不勝感激。

回答

1

使用如下的BSH條件,

<field use-when="${bsh:emplPositionId==userLogin.partyId}" name="emplPositionId" title="${uiLabelMap.HumanResEmployeePositionId}" widget-style="linktext"> 
    <hyperlink also-hidden="false" description="${emplPositionId}" target="emplPositionView"> 
     <parameter param-name="emplPositionId"/> 
    </hyperlink> 
</field>