Calling a JSF popup from a Managed Bean

Asked

Viewed 2,395 times

1

I use this Javascript to call a popup in JSF:

function showMyPage() { 
    window.open('./showMyPage.xhtml','mywindow', 'resizable=no,toolbar=no,scrollbars=yes,height=450,width=530,top=145,left=235');
    return true;
}

But, I want to call it straight a Managed Bean, this is possible?

Example, I have the following condition, of a p:dataTable:

<p:column >
    <h:commandLink action="#{tabelasBean.list(ind)}" >  
        <i class="cus-find"></i> 
    </h:commandLink>  
</p:column>

I want to call the popup by Managed Bean, this is possible?

public String list(InfoListVO ind){         
    FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("InfoListVO ", ind);

    //aqui quero retornar minha popup direto do Managed Bean
    return "myPage";
}

Thanks in advance!

1 answer

1


With the first faces just do this: RequestContext.getCurrentInstance().execute("PF('nomeDoDialog').show();");

I passed the answer through the first faces because you put it in the question tags.

  • I could do that of richfaces in the same way Requestcontext.getCurrentInstance(). execute("#{rich:Component('popup')}.Hide(); Return false;"); ? Thank you for the reply !

  • It’s been a long time since I left the richfaces and only use the primefaces, but you can see if this link helps you in the richfaces: http://entjavastuff.blogspot.com.br/2010/09/richfaces-modal-panel.html If the answer has resolved your question please don’t forget brand-namethere as correct ;)

  • 1

    Only complementing is the dialog widgetVar not the id.

  • That’s right, where place 'nameDoDialog' is the Dialog widgetVar parameter, thanks @Rafael

  • I ended up using this way, but your example worked correctly:

  • 1

    <p:commandLink action="#{tableBean.list(Ind)}" oncomplete="showMyPage()"> <i class="cus-find"></i> </p:commandLink> Thank you !

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.