6
<p:dataTable id="id" value="#{bean.soemList}" var="account">
    <p:commandLink value="#{account.id}" action="#{bean.methodCall}" 
        update="dialogID" oncomplete="dlg1.show();">
    </p:commandLink>

...

<p:dialog header="#{i18n.details}" widgetVar="dlg1" modal="true" height="200" width="600">
    <h:panelGroup id="dialogID" layout="block">
        <h:outputLabel value="#{bean.var1}"></h:outputLabel>
    </h:panelGroup>
</p:dialog>

p:dialog gets updated when the link is outside p:dataTable, but when the link is placed in p:dataTable, p:dialog doesnt show updated value. I need to keep the link in p:dataTable.The component to be updated is not in dataTable.

StarsSky
  • 6,721
  • 6
  • 38
  • 63
Bosco
  • 3,835
  • 6
  • 25
  • 33
  • Can you post your bean.methodCall code? I have the same problem – JsfLearner Sep 16 '11 at 16:49
  • @SfsLearner : In bean method I am just changing the value of the variable. The changed value should be displayed in h:outputLabel which is inside p:dialog , but the problem is it still displays the old value and not the new value. But it changes the value of the variable in bean method but new value is not reflected on the page. public String methodCall(){ this.var1=true; } in this case after method call the page still displays 'false' – Bosco Sep 17 '11 at 02:57

2 Answers2

0

Hi did you try to append the form id as follows

<form id="myformid">
.....
    <p:commandLink value="#{account.id}" action="#{bean.methodCall}" update=":myformid:dialogID" oncomplete="dlg1.show();">
    </p:commandLink>
....
<p:dialog header="#{i18n.details}" widgetVar="dlg1" modal="true"
        height="200" width="600">
        <h:panelGroup id="dialogID" layout="block">
        <h:outputLabel value="#{bean.var1}"></h:outputLabel>
....
</form>

Hope it helps !

Jakjoud
  • 41
  • 1
0

I have only been able to get a <p:commandLink> within a dataTable to update a component of a dialog if the elements of that dialog were within their own <h:form>.

Example:

<p:dialog appendToBody="true" ...>
  <h:form id="dialogForm" ...>
    ...
  </h:form>
</p:dialog>

<p:dataTable ...>
  <h:form id="dataTableForm" ...>
    ...
  </h:form>
</p:dataTable>

Also note that I added to the dialog the attribute, appendToBody="true". This is important for locating the dialog by id after an AJAX update.

maple_shaft
  • 10,435
  • 6
  • 46
  • 74
  • Hi maple , thanks for replying.. in my code .. p:dataTable and p:dialog are present inside common
    tag..
    – Bosco Sep 16 '11 at 11:39
  • @Amruta, Yes, don't do that. Refactor to give each dialog its own inner form and a give one common form for other components on the page. Also remember to apply the `appendToBody="true"` tag. – maple_shaft Sep 16 '11 at 12:01
  • When I used ':mainFormId:idOfThePanelCantainingDialog' , it worked.I did not use separate forms. Thanks for your reply n e ways :). – Bosco Sep 19 '11 at 09:16