What I want is commandButton should complete the action first and then update dataTable, but it is actually updating dataTable before the action is performed. Can someone please suggest how to do this?. Thanks.
<p:dataTable id="files" var="file" value="#{tableBean.lstFiles}" rowKey="#{file.fname}" selection="#
{tableBean.selectedFile}" selectionMode="single" >
<p:ajax event="rowSelect" listener="#{tableBean.onRowSelect}" />
<p:ajax event="rowUnselect" listener="#{tableBean.onRowUnselect}"/>
<p:column headerText="Date"> #{file.fname}</p:column>
<p:column headerText="Type"> #{file.ftype}</p:column>
<p:column headerText="Date"> #{file.fdate}</p:column>
<p:column headerText="View File" >
<p:commandButton id="folder" action="#{folderName.name}" value="Open" update=":form2:files" icon="ui-icon-arrowthichk-s" >
<f:setPropertyActionListener target="#{folderName.foldername}" value="#{file.fname}" />
</p:commandButton>
</p:column>
</p:dataTable>