-
1. Re: Open a pop-up window from a command button
gonorrhea Apr 3, 2009 12:27 AM (in response to ricardoalonso)try this, it works in my code:
<h:form> <a4j:jsFunction name="reRenderProblemCodeModal" reRender="problemCodeDataModalDiv" oncomplete="Richfaces.showModalPanel('editProblemCodePanel');"/> </h:form>
<h:form id="populateProblemCodesForm"> <a4j:commandLink value="Edit" ajaxSingle="true" action="#{repairCaseDetails.populateProblemCodesModalPanel(equipmentRepairProblemCodeList.getRowIndex())}" oncomplete="reRenderProblemCodeModal();"/> </form>
-
2. Re: Open a pop-up window from a command button
gonorrhea Apr 3, 2009 12:28 AM (in response to ricardoalonso)you can substitute <a4j:commandButton> for <a4j:commandLink>
-
3. Re: Open a pop-up window from a command button
ricardoalonso Apr 6, 2009 5:50 PM (in response to ricardoalonso)The problem is that I need to open a real new browser window, not just a modal pane, because in this new window will appear a report pdf.
-
4. Re: Open a pop-up window from a command button
gonorrhea Apr 6, 2009 6:13 PM (in response to ricardoalonso)try this, i just tested it:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:s="http://jboss.com/products/seam/taglib" template="/templates/normal.xhtml"> <ui:define name="body"> <h:form> <a4j:jsFunction name="openWindow" oncomplete="window.open ('http://www.javascript-coder.com','mywindow','menubar=1,resizable=1,width=350,height=250');" /> </h:form> <h:form> <a4j:commandButton value="Open Window" onclick="openWindow()"/> </h:form> </ui:define> </ui:composition>
-
5. Re: Open a pop-up window from a command button
ricardoalonso Apr 9, 2009 10:11 PM (in response to ricardoalonso)but how to pass the action result to this new window?
the new window should show a jasper report with the params of the base page.
-
6. Re: Open a pop-up window from a command button
gonorrhea Apr 9, 2009 10:48 PM (in response to ricardoalonso)You could use Seam Remoting to access the action result variable stored in a JavaBean or session bean.
And then dynamically construct the URL (HTTP GET request) by appending the params from the Seam remoting call and then using that as the first param of the window.open() call.
window.open('/foo/bar?a1=1234','mywindow','menubar=1,resizable=1,width=350,height=250');
where a1=1234 is the result of the Seam remoting call...
WARNING: I have not tested this!
-
7. Re: Open a pop-up window from a command button
pgmjsd Apr 13, 2009 6:55 PM (in response to ricardoalonso)
Arbi Sookazian wrote on Apr 09, 2009 22:48:
You could use Seam Remoting to access the action result variable stored in a JavaBean or session bean.
And then dynamically construct the URL (HTTP GET request) by appending the params from the Seam remoting call and then using that as the first param of the window.open() call.window.open('/foo/bar?a1=1234','mywindow','menubar=1,resizable=1,width=350,height=250');
where a1=1234 is the result of the Seam remoting call...
WARNING: I have not tested this!I think if you do this you should make sure that the Seam Remoting call does't fire when there is already an A4J request happening. If requests from Seam Remoting and A4J hit the server simultaneously then Seam's contexts can get messed up. Usually Seam Remoting ends up failing due to 'no conversation' or something like that.