2
votes

We are using jsf 2.1 + primefaces 6.0 + primefaces-extensions 6.0.0, mojarra 2.1.7 under weblogic 11g.

We are using primefaces 6.0 for the first time due to nested dialogs requirement.

We have detected one issue when opening dialog from backing bean using Dialog Framework in a page with frames.

We have one menu on the left and on the right we access to this xhtml page (taken from showcase):

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
    <h:form>
        <p:commandButton value="View" icon="ui-icon-extlink" actionListener="#{dfView.viewCars}" />
    </h:form>
</h:body>
</html>

Once p:commandbutton is clicked, DOM inspector shows that dialog has been created outside body and html tags, as shown on next image:

Dialog rendered outside body

If we create a new .xhtml with same code (and no frames) and click the p:commandButton result is as expected and dialog is opened:

Dialog rendered correctly

We've been trying to add attribute "appendTo" from backingBean but nor "body" nor "@body" nor "@(body)" works:

package test;

import java.util.HashMap;
import java.util.Map;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;

import org.primefaces.context.RequestContext;
import org.primefaces.event.SelectEvent;

@ManagedBean(name = "dfView")
public class DFView {

public void viewCars() {
    final Map<String,Object> options = new HashMap<String, Object>();
    options.put("resizable", false);
    options.put("appendTo", "@(body)");
    RequestContext.getCurrentInstance().openDialog("viewCars", options, null);
}

public void viewCarsCustomized() {
    final Map<String,Object> options = new HashMap<String, Object>();
    options.put("modal", true);
    options.put("width", 640);
    options.put("height", 340);
    options.put("contentWidth", "100%");
    options.put("contentHeight", "100%");
    options.put("headerElement", "customheader");

    RequestContext.getCurrentInstance().openDialog("viewCars", options, null);
}

public void chooseCar() {
    RequestContext.getCurrentInstance().openDialog("selectCar");
}

public void onCarChosen(final SelectEvent event) {
    final Car car = (Car) event.getObject();
    final FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Car Selected", "Id:" + car.getId());

    FacesContext.getCurrentInstance().addMessage(null, message);
}

public void showMessage() {
    final FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "What we do in life", "Echoes in eternity.");

    RequestContext.getCurrentInstance().showMessageInDialog(message);
}
}

Is there any workaround for this issue?

Thanks in advance,

Alejandro

PS. Same code in Primefaces 5.2 works fine with frames

1

1 Answers

0
votes

I am using primeface 6.0 and I created a dialog also a inner confirm dialog. I solved my problem related to dialog is blocked and confirm dialog also.

I added the next code in the inner confirm dialog: <p:confirmDialog appendTo="@(body)"