0

I'm trying to open a new window from dataTable using primefaces. I've tried differents options:

  1. h:commandLink

    <h:form id="form" target="_blank">
       <p:dataTable id="Table" var="var_row" value="#{bean.table}" sortBy="tableId" > 
            <p:column>
                 <h:commandLink action="#{bean.goToPage}" value="Open Page" 
                                onblur="this.form.target='_self'">  
                       <f:setPropertyActionListener value="#{var_row}" target="#{bean.rowSelected}" />  
                 </h:commandLink> 
             </p:column>  
       </p:dataTable>
    </h:form>
    

2.p:commandLInk

   <h:form id="form" target="_blank">
       <p:dataTable id="Table" var="var_row" value="#{bean.table}" sortBy="tableId" > 
            <p:column>
                 <p:commandLink action="#{bean.goToPage}" value="Open Page" 
                                onblur="this.form.target='_self'"
                                process="@this" ajax="false" target="_blank">  
                       <f:setPropertyActionListener value="#{var_row}" target="#{bean.rowSelected}" />  
                 </p:commandLink> 
             </p:column>  
       </p:dataTable>
    </h:form>

It works, but not correctly. I mean, I get the new page open, but the original page becomes useless, all methods in this pages are not invoked when you clicked on them.

Has anyone experimented this before? Any idea to solve this?

royhowie
  • 11,075
  • 14
  • 50
  • 67
Liesel
  • 1
  • 1
  • 3

1 Answers1

0

I tried and I still couldn't get a 'commandLink' to open in a new window while at the same time using 'setPropertyActionListener'. I think you have to modify the underlying Primefaces javascript to open in a new window (I didn't try that).

You can try passing a parameter argument.

user3749223
  • 58
  • 1
  • 11