2013-01-17 54 views
3

我正在使用Primefaces 3.4和JSF 2.0。我有一個號碼:commandLink:cellEditor中的commandLink不會觸發動作/動作監聽器

<p:commandLink action="#{wizard.onRemoveFoodItem}" update="@(#ingredientListContent)" immediate="true"> 
    <span class="ui-icon ui-icon-close"></span> 
    <f:setPropertyActionListener target="#{wizard.selectedFoodItem}" value="#{foodItem}" /> 
</p:commandLink> 

它的目的是爲了從食物在我的P A名單中刪除行:DataTable,並將它正常情況下工作。問題在於,我還想讓ap:rowEditor處於相同的位置,對於那些熟悉primefaces rowEditor的用戶,在編輯時可以看到一個檢查和一個x圖標(用於結束編輯模式)我不想有兩個關閉圖標,其中一個含義是取消編輯模式,另一個用於移除當前行。

所以我決定將它嵌入在AP:cellEditor中,這樣的「X」刪除編輯過程中該行被隱藏:

<p:cellEditor> 
    <f:facet name="output"> 
     <p:commandLink action="#{wizard.onRemoveFoodItem}" update="@(#ingredientListContent)" immediate="true"> 
      <span class="ui-icon ui-icon-close"></span> 
      <f:setPropertyActionListener target="#{wizard.selectedFoodItem}" value="#{foodItem}" /> 
     </p:commandLink> 
    </f:facet> 
    <f:facet name="input"><h:outputText value="" /></f:facet>      
</p:cellEditor> 

這奇怪發送一個Ajax請求,並得到更新響應(無明顯的驗證錯誤),但是它不會像在p:cellEditor標記中那樣調用onRemoveFoodItem操作方法。我明白,p:cellEditor並不是真正用於這種方式,但我會假設可見時,它的行爲就好像沒有圍繞它的p:cellEditor。

任何人都可以在這裏看到任何明顯錯誤,或者這是一個Primefaces的問題?我會很感激任何幫助。

+0

我對這個問題做了一個解決方法,將刪除按鈕的圖標改爲'ui-icon-circle-close'。儘管如此,仍然會很高興有這個問題的答案。 – Neil

回答

6

我有一個類似的問題,並通過添加方法來解決它=「@這個」屬性號碼:commandLink

+0

今晚我會試試!謝謝您的意見! – Neil