Reputation: 157
Is there a way to use "oncomplete" from a4j:commandLink to open a new tab like "target" from h:commandLink ? something like:
target="#{dashBoardBean.possuiDocumento ? '_blank' : '_self'}"
<a4j:commandLink action="#{dashBoardBean.visualizarDocumento}"
oncomplete="#{dashBoardBean.possuiDocumento}">
</a4j:commandLink>
right now my code is like this:
<h:commandLink action="#{dashBoardBean.visualizarDocumento}"
target="#{uc.documento ? '_blank' : '_self'}">
<f:setPropertyActionListener value="#{uc}" target="#{dashBoardBean.contentTarget}" />
<de:statusContent content="#{uc}"/>
</h:commandLink>
now i need to make a check after the action and only then open the new tab, but h:commanLink doesn't have oncomplete.
Upvotes: 1
Views: 1870
Reputation: 1053
you can do it like this:
<a4j:commandLink action="#{dashBoardBean.visualizarDocumento}" update="@this"
oncomplete="window.open('yourNewPage.xhtml', '#{dashBoardBean.possuiDocumento ? '_blank' : '_self'}')">
</a4j:commandLink>
Upvotes: 1