ThunderPhoenix
ThunderPhoenix

Reputation: 1883

click event for <p:outputLabel> with <p:ajax> inside <p:datatable>

I created a <p:datatable> and I added a column which display a trash icon in each row, and I want delete a row by clicking on the trash icon.

here is my page :

<p:column width="4%">
    <p:outputLabel id="dragIcon" styleClass="ui-icon ui-icon-trash">
         <p:ajax event="click" update="exploitTable" listener="#{bean.onDelete(item)}"/>
    </p:outputLabel>
</p:column>

item is the value of var attribute of <p:datatable>.

But it seems that the onDelete method is not called.

Any help ?

Upvotes: 0

Views: 3925

Answers (1)

ThunderPhoenix
ThunderPhoenix

Reputation: 1883

I resolved the problem :

I used <p:commandLink> instead of <p:outputLabel>.

<p:column width="3%">
    <p:commandLink id="delete" styleClass="ui-icon ui-icon-trash" actionListener="#{listeExploitant.onDelete(exploitant)}" update="exploitTable"/>
</p:column>

Upvotes: 0

Related Questions