Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

commandLink in cellEditor doesn't trigger action/actionListener

I'm using Primefaces 3.4 and JSF 2.0. I have a p: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> 

It's purpose is to remove a row from a list of food items in my p:dataTable and it works under normal circumstances. The problem lies in the fact that I want to also have a p:rowEditor in the same position, and for those of you that are familiar with primefaces rowEditor, while editing, you can see a check and an x icon (for ending edit mode) and I don't want to have two close icons with one meaning to cancel edit mode and one to remove the current row.

So I decided to embed it in a p:cellEditor so that the "x" to remove the row is hidden during editing:

<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> 

This strangely sends an ajax request and gets an update response (with no apparent validation error), but it doesn't call the action method onRemoveFoodItem like it did when it wasn't inside an p:cellEditor tag. I understand that p:cellEditor wasn't really meant to be used this way, but I would assume when visible, it would behave as if there were no p:cellEditor surrounding it.

Can anyone see anything obviously wrong here or is this an issue with primefaces? I would be grateful for any help.

like image 831
Neil Avatar asked Jan 17 '13 13:01

Neil


1 Answers

I’ve got a similar problem and solved it by adding process="@this" attribute to p:commandLink.

like image 91
DmG Avatar answered Nov 02 '22 21:11

DmG