2010-09-17 50 views
0

我們有以下豐富:ComponentControl:問題,從豐富的傳遞布爾值:ComponentControl以呈現豐富:的菜單項

<rich:componentControl event="onRowClick" for="ctxMenu" operation="show"> 
<f:param value="#{item.hasDocuments}" name="hasDocuments" /> 
</rich:componentControl> 

的#{} item.hasDocuments值被成功地從bean作爲傳遞無論是真或假。

下面是這是應該有條件地顯示該項目的文本菜單:

<rich:contextMenu id="ctxMenu" submitMode="ajax" attached="false"> 
<rich:menuItem ajaxSingle="true" value="View Documents oncomplete="#{rich:component('documentsMenu')}.doShow(event, {})" reRender="documentsMenu" rendered="#{hasDocuments}"> 
<a4j:actionparam name="selectedApplicationId" value="#{applicationId}" assignTo="#{activeAppsForm.applicationId}" /> 
</rich:menuItem> 
</rich:contextMenu> 

的問題是,它總是隱藏鏈接,即使{} hasDocuments是真實的。 我的猜測是{hasDocuments}的值被視爲字符串而不是布爾值,因此呈現將始終爲假。

有關如何解決此問題的任何想法?

+0

你應該更新你的問題解決了EL語法錯誤,避免紅鯡魚。 – BalusC 2010-09-17 17:30:09

+0

更新了問題。任何其他想法如何解決這個問題? – droidy 2010-09-17 17:32:34

回答

0

兩個問題。首先從rich:componentControl傳遞的參數在menuItem中沒有填充圖標的情況下被引用。所以你想要的東西像

rendered="{hasDocuments}" 

但這仍然不會因爲第二個問題的工作。據我所知,從rich:componentControl傳遞的參數總是作爲字符串傳遞的。

因此,請嘗試將hasDocuments作爲字符串處理。你想要的東西,看起來像

rendered="#{{hasDocuments}.equals('true')}" 

巨大的警告:這主要是理論,我看到在我的應用程序類似的問題,我還沒有制定。如果您設法解決問題,請發佈您的答案。

1

我花了2個小時解決了這個問題。但最終它解決了。請嘗試以下操作:

rendered="#{hasDocuments == 'true'}"