java - How to open mutiple dialog using Primefaces dialog framework -


I'm new to JSF and primface, I need to open a search button that contains search result information whenever A search button was clicked. Before open dialog should always be shown, unless the user closes it, then I have more than one conversation open.

I am using the techniques below, and my problem is that I want to use only one XHTML Template dialog which I call using the PMFS communication framework. What do I want from any idea?

  • Jeffs 4.0
  • JSF 2.2

    I have a sample code that I'm trying to do as a POC below I'm working fine, I can first display the dialogue, but I have no idea how to open another dialog after clicking the search button again.

    home.xhtml

      & lt; Div id = "searchBtnDiv" & gt; & Lt; p: command button id = "query networkwork" value = "search" ajax = "true" actionListener = "# {searchBean.querySubmit}" /> & Lt; p: Command Button ID = "Advances" value = "advance search" ajax = "true" actionListener = "# {searchBean.querySubmit}" /> & Lt; / Div & gt; Public Segment SearchBean {... Public Zero Generation SearchDialog (String Search Param) throws IOException {@} SearchBean.java <@ < System.out.println ("Initial dialogue"); Testmessage = "test";. RequestContext.getCurrentInstance () openDialog ("test");} ...}   

    test.xhtml

      & lt; xml version = "1.0" encoding = "UTF-8"? & gt; & gt; DOCTYPE HTML PUBLIC "- // W3C // DTT XHTML 1.0 Transcription / / N "" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">> html xmlns = "http://www.w3.org/1999/xhtml" xmlns : H = "http://xmlns.jcp.org/jsf/html" xmlns: f = "http: // xmlns Jcp.org/jsf/core" xmlns: ui = "http: / /xmlns.jcp.org/jsf/facelets "xmlns: p =" http://primefaces.org/ui "xmlns: c =" http: / /xmlns.jcp.org/jsp/jstl/core"> LT; g: top & gt; & lt; / h: top & gt; & lt; h: body & gt; & lt; h1 & gt; & lt; p: output label value = "# {searchBean.testMessage} "/> Gt; & Lt; / H1> & Lt; P: Command button value = "test" /> & Lt; / H: Body & gt; & Lt; / Html & gt; GenericSearchDialog generates your method only displays: id = "test" with    

    Dialog page. What will it do that it will open that dialogue and will be the only one (which means, if you close the dialog and call the method again, then it will be opened again).

    What do I think, do you want to create a new dialog instance with each call to generate the search dialog?

    If you want to do this, then you need to create a new dialog instance dynamically in your web page, create a container for these dialogs (like a panel group) and every time the method is called It will make a new dialog example. Keep in mind that there is not a good practice to programmatically communicate in backing beans, but it will help you get it. Now, to make this work, the headline of the dialog should be dynamic (maybe adding a counter?) Your backing bean will look something like this:

      UIComponent panelGroup = FacesContext.getCurrentInstance ( ) .getViewRoot) .findComponent ("dialogContainer"); Dialog dialog = new dialog (); Dialog.setId ("newDialogInstance" + counter); Dialog.setVisible (true); // whatever code you add ... panelGroup.getChildren (). Add (dialog); ... // Update RequestContext.getCurrentInstance in the entire panel (). Update ("dialog"); // open your openDialog or New Dialog RequestContext.getCurrentInstance (). OpenDialog ("newDialogInstance" + counter); ... counter ++;    

  • Comments

    Popular posts from this blog

    Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

    multithreading - PhantomJS-Node in a for Loop -

    c++ - MATLAB .m file to .mex file using Matlab Compiler -