Dynamically create PrimeFaces dialogs

I am using price lists 3.3.1 and JSF 2 (Mojarra 2.1.9).

I have a page with the DataTable component and a dialog box to display the details of the DataTable records. It is very simple when I have one dialogue. What I want is to try to allow users to open two or three manuals with the details of different records at the same time. Does anyone know how to get the full AJAX dialog from the server, and not just the contents of the dialog?

+5
source share
3 answers

Yes, I did it. To do this, I created the necessary dialogs programmatically with the support of a bean. I know that this is not the best practice, but at this moment I think this is only a possible solution. First of all, I added one panel, which is a container for dialogs on my JSF page. Then, with bean support, I have a code like this:

UIComponent panelGroup = facesContext.getViewRoot().findComponent("panel_id");
Dialog dialog = new Dialog();
dialog.setHeader("Sample");
dialog.setVisible(true);
dialog.setMinimizable(true);
...
panelGroup.getChildren().add(dialog);
...
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.update("panel_id");
+6
source

A dialog identifier can also be dynamic, so you can create some identifier or other value and give it one.

<p:dialog header="Choose Delimiter Type" id="dialog"
    widgetVar="exportDialog#{p.Id}" resizable="false" >

and a call through the button;

<p:commandButton id="id" value="xxx"
            actionListener="#{p.export2CSV}" ajax="false"
            onclick="exportDialog#{p.tabId}.show()">                
        </p:commandButton>
+3
source

@newuserua widgetVar ,

...
requestContext.update("panel_id");

, .

0

All Articles