p:commandLink inside p:dataTable not working with ajax=true

UI Components for JSF
Post Reply
nirvanbd
Posts: 45
Joined: 16 Oct 2010, 16:17

10 Dec 2010, 08:15

I am trying to use a p:commandLink inside a p:dataTable to remove row from the dataTable. The link functions only when I set ajax="false". Here is the code that works but without ajax.

Code: Select all

<p:dataTable id="fileTable" value="#{sendMailBean.attachments}" var="file"
				 style="margin: auto;" emptyMessage="" styleClass="attachmentTable"
				 rendered="#{!(empty sendMailBean.attachments)}">
		..............	
		<p:column>
			<p:commandLink value="Remove" ajax="false"
						   actionListener="#{sendMailBean.removeUploadedFile(file)}">
			</p:commandLink>
		</p:column>
	</p:dataTable>
However I want the commandLink to work in ajax mode as given under.

Code: Select all

	<p:column>
			<p:commandLink id="link" value="Remove" ajax="true" process="filePanel" update="filePanel"
						   actionListener="#{sendMailBean.removeUploadedFile(file)}">
			</p:commandLink>
		</p:column>
Why is the p:commandLink not working with ajax="true"

regards,
Nirvan.

User avatar
bumble.bee
Posts: 723
Joined: 29 Sep 2010, 21:39
Location: United States

10 Dec 2010, 14:59

Might be an issue with your process and update attribute values. Try something like this:

Code: Select all

<p:column>
    <p:commandLink ajax="true" action="#{myBean.remove(entity)}" update="@form growl" process="@form">
        <span title="Remove" class="ui-icon ui-icon-trash"/>
    </p:commandLink>
</p:column>
...
<p:growl id="growl"/>

nirvanbd
Posts: 45
Joined: 16 Oct 2010, 16:17

10 Dec 2010, 16:22

Bumble.bee,
You were correct. I prepended the form id and it works now. Thanks.

regards,
Nirvan.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 75 guests