I'm using primefaces 3.3.1 and JSF 2 (Mojarra 2.1.9).
I have a page with a DataTable component and Dialog to show details of DataTable entries. That's very simple when I have one dialog. What I want is to try to allow users to open two or three dailogs with details of different entries in the same time. Does somebody have any idea how to get whole dialog with AJAX from server, not just a dialog content?
Yes I did. For this purpose I created necessary dialogs programmatically in backing bean. I know this is not really best practice, but in this moment I think this is only possible solution. First of all I added one group panel which is container for dialogs on my JSF page. Then on backing bean I have some 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");
Dialog id also can be dynamic so you can create some id or some other value and give it him.
<p:dialog header="Choose Delimiter Type" id="dialog"
widgetVar="exportDialog#{p.Id}" resizable="false" >
and calling via button ;
<p:commandButton id="id" value="xxx"
actionListener="#{p.export2CSV}" ajax="false"
onclick="exportDialog#{p.tabId}.show()">
</p:commandButton>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With