there is "race" between two requests:
-submit form (perform actions) and receive answer
-open popup with new page

if submit would win (hit server looong beforem popup request), than action would be performed and popup could have "fresh" data in 99.(9)% cases popup wins, so it doesnt have proper data generated by its parent request.

the most obvious solution (and the worst:P) is to generate delay in popup window - its stupid so lets leave it.

i have 2 concepts:

1. in your parent page u can have <body onload=openPopup()>
so u are sure that popup will be opened AFTER submit.

2. u can pass parameter to popup:
onclick="window.open('detailStockInv.jsp?id=#{row.id}','','width=700,height=400,top=100,left=100')">

detailStockInv.jsp page must get parmeter id from url and ofcourse perform somme logic (i assume that row is your var attrib from datatable).



cheers

Slawek


Yes indeeed Sean. That's is exactly what I said at the end of my post. But my question is : is it possible to open a popup window (with or without javascript) to display my detailed informations ? if yes, how ?

Thanks.

-----Message d'origine-----
De : Sean Schofield [mailto:[EMAIL PROTECTED]
Envoyé : jeudi 21 juillet 2005 16:12
À : MyFaces Discussion
Objet : Re: commandLink and onClick javascript popup window problem

I think your problem is that you are opening the window with an
*onclick* javascript even.  This has nothing to do with the JSF
lifecycle.  The regular commandLink approach (without using onclick)
works because you post back (via a form) to the same page.  In your
case you are just opening the page in a new window.  How would JSF
know the new values from that?

sean

On 7/21/05, Clément Maignien <[EMAIL PROTECTED]> wrote:



Here is the situation :

I have a JSF page (result.jsp) with dataTable component with a commandLink
in one of his columns.

When clicking on this commandLink, I would like to open a popup window
(detailStockInv.jsp) to display detail informations about the line that has
been clicked.

Here is the code I wrote :

<x:dataTable id="stockdatatable" rowIndexVar="numRow"

...

       <h:column> ... </h:column>

       ...

       <h:column>

<f:facet name="header">

<h:outputText value="#{res['stock_Etat_Visu_Stockinv']}" />

</f:facet>

<h:commandLink styleClass="linkRed"
actionListener="#{stockBean.updateDetailStock}


onclick="window.open('detailStockInv.jsp','','width=700,height=400,top=100,left=100')">



<h:outputText value="#{stock.stockInv}"/>

<f:param name="numLineClicked" value="#{numRow}"/>

</h:commandLink>

</h:column>

...

</x:dataTable>



I've put an actionListener to update datas (a bean property) that are
displayed in the popup page (detailStockInv.jsp) in a dataTable component.



My popup is opened and displayed when I click one of the commandLink of my results dataTable, but the problem is that the bean values that are read by my popup page are the previous ones : the first time I click a commandLink,
the values displayed by the popup are not the ones updated by my
actionListener but the initial ones (inited in the bean constructor). The second time I click a commandLink, the values of the line I cliked before
are displayed.



In my opinion, the popup is displayed before the update model value phase of the JSF life cycle occurs. As a consequence, the previous bean values are
displayed in my popup page.

To confirm that, I tried not to display this page in a popup, but in the
same window (normal flow) with the action property of the commandLink :

<h:commandLink styleClass="linkRed" action="#{stockBean.showDetailAction}"

<h:outputText value="#{stock.stockInv}"/>

       <f:param name="numLigneClicked" value="#{numRow}"/>

</h:commandLink>



The showDetailAction action and the updateDetailStock actionListener are
doing exactly the same work (updating the detail values of my bean), except that it return a navigation result to display the detailStockInv.jsp page

In this way, the values that are displayed in the detailStockInv.jsp are the
good ones (the bean's ones).



Is there a way to force the update value phase before the popup is displayed
? Maybe the way I call the popup isn't the right one ... don't know.



Please help, thanks :D



Clément Maignien.















Reply via email to