I'm testing a simple example with Dialog Framework. According to the documentation, there is an "onHide" configuration option which is a "Client side callback to execute when dialog is hidden". However, I'm not getting this to work with this simple configuration (in the view component):
Code: Select all
public void openDialog() {
Map<String,Object> options = new HashMap<String, Object>();
options.put("onShow", "alert('df onshow')");
options.put("onHide", "alert('df onhide')");
PrimeFaces.current().dialog().openDynamic("dialog.xhtml", options, null);
}
Full source code:
1) index.html
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Index</title>
</h:head>
<h:body>
<p:growl id="growl" showDetail="false" sticky="false">
<p:autoUpdate />
</p:growl>
<h2>Index</h2>
<h:form prependId="false">
<p:commandButton value="DF" action="#{indexView.openDialog}" />
</h:form>
</h:body>
</html>
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>DF Dialog</title>
</h:head>
<h:body>
<h2>DF dialog</h2>
</h:body>
</html>
Code: Select all
package view;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
import org.primefaces.PrimeFaces;
@Named
@ViewScoped
public class IndexView implements Serializable {
private static final long serialVersionUID = 1L;
public void openDialog() {
Map<String,Object> options = new HashMap<String, Object>();
options.put("onShow", "alert('df onshow')");
options.put("onHide", "alert('df onhide')");
PrimeFaces.current().dialog().openDynamic("dialog.xhtml", options, null);
}
}
Primefaces: 8.0
Mojarra 2.3.9.SP04
Wildfly: 18.0.1
Thanks in advance!