Reputation: 12465
I have a databable with the following definition :
<h:form prependId="false">
<p:dataTable id="instancesTable" lazy="false" paginator="false" var="instance"
value="#{panaceaController.instances}">
<p:column>
<f:facet name="header">
<h:outputText value="Directory"/>
</f:facet>
<p:commandLink value="#{instance.directory}" target = "instance.jsf">
<f:setPropertyActionListener value="#{instance}" target="#{panaceaController.instance}"/>
</p:commandLink>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Running"/>
</f:facet>
<h:outputText value="#{instance.running}"/>
</p:column>
<p:column>
<f:facet name="header">
Options
</f:facet>
<p:commandLink id="properties_link" async="true" update="propertiesTable" oncomplete="propertiesDialog.show();">
<h:graphicImage value="img/properties.png" />
<f:setPropertyActionListener value="#{instance}" target="#{panaceaController.instance}"/>
</p:commandLink>
<p:tooltip for="properties_link" value="Edit Properties" showEffect="fade" hideEffect="fade" />
<p:commandLink id="delete" async="true" onclick="confirmDelete.show();" >
<h:graphicImage value="img/edit-delete.png"/>
<f:setPropertyActionListener value="#{instance}" target="#{panaceaController.instance}"/>
</p:commandLink>
<p:tooltip for="delete" value="Delete This Instance" showEffect="fade" hideEffect="fade" />
<h:panelGroup rendered="#{!instance.running}">
<p:commandLink id="start" async="true" action="#{panaceaController.start}" update="messages instancesTable">
<h:graphicImage value="img/start.png"/>
<f:setPropertyActionListener value="#{instance}" target="#{panaceaController.instance}"/>
</p:commandLink>
<p:tooltip for="start" value="Start Instance" showEffect="fade" hideEffect="fade" />
</h:panelGroup>
<h:panelGroup rendered="#{instance.running}">
<p:commandLink id="stop" async="true" action="#{panaceaController.stop}" update="messages instancesTable">
<h:graphicImage value="img/stop.png"/>
<f:setPropertyActionListener value="#{instance}" target="#{panaceaController.instance}"/>
</p:commandLink>
<p:tooltip for="stop" value="Stop Instance" showEffect="fade" hideEffect="fade" />
</h:panelGroup>
<p:commandLink id="probe" async="true" action="#{panaceaController.probe}" update="messages instancesTable">
<h:graphicImage value="img/probe.png"/>
<f:setPropertyActionListener value="#{instance}" target="#{panaceaController.instance}"/>
</p:commandLink>
<p:tooltip for="probe" value="Probe if instance is running" showEffect="fade" hideEffect="fade" />
</p:column>
</p:dataTable>
</h:form>
The delete commandLink updates the table OK, but other commands simply don't update the "instancesTable" even though they update the "messages" correctly. I am using primefaces 3.0M3
Can somebody help me with this please?
Upvotes: 0
Views: 2397
Reputation: 39
Just give the ID of the component which you want to update in the commandbutton update="instancesTable"
Upvotes: 0
Reputation: 544
I think you could try to surround dataTable with a outputpanel, and gives the outputpanel a styleClass(This styleClass is for update only.), and then updates the outputpanel by styleClass just like this:update="@(.yourPanelStyleClass)"
. It works well in my case, but I`m not sure if it works well for you.
Upvotes: 0
Reputation: 10463
There were a number of bugs associated with AJAX updates of a dataTable component for actions triggered within components of a dataTable. Most of these should have been fixed in the latest Primefaces version 3 release however you didn't really state which version of Primefaces you are using.
I posted a workaround to this in a previous answer here. Essentially you would from the client side invoke a javascript to manually invoke a click event on a hidden button outside of the dataTable.
Upvotes: 1