This content has been marked as final.
Show 4 replies
-
1. Re: create modal panel dinamically
ilya_shaikovsky Sep 4, 2007 6:49 AM (in response to kgoedert)you may use standard binding to create it dynamically.
As for calling - its just JS functions calls so you may cal them in any handler you need. -
2. Re: create modal panel dinamically
kgoedert Sep 4, 2007 6:52 AM (in response to kgoedert)Could you please give me an example?
-
3. Re: create modal panel dinamically
ilya_shaikovsky Sep 4, 2007 7:37 AM (in response to kgoedert)please (a very simple example):
page:<h:form> <a4j:commandButton value="showMp" oncomplete="javascript:Richfaces.showModalPanel('_panel',{left:'auto', top:'auto'})" action="#{mpBean.mpInit}" reRender="test"/> </h:form> <a4j:outputPanel id="test"> <rich:modalPanel binding="#{mpBean.mp}"/> </a4j:outputPanel>
Java code:import javax.faces.component.html.HtmlOutputText; import org.richfaces.component.html.HtmlModalPanel; public class MpBean { HtmlModalPanel mp = new HtmlModalPanel(); public MpBean() { } public String mpInit() { mp.setId("_panel"); HtmlOutputText text= new HtmlOutputText(); text.setValue("Hello"); mp.getFacets().put("header", text); HtmlOutputText text2 = new HtmlOutputText(); text2.setValue("sample"); mp.getChildren().add(text2); return null; } public HtmlModalPanel getMp() { return mp; } public void setMp(HtmlModalPanel mp) { this.mp = mp; } }
So after button pressed - mp is created, refreshed on a page and called after request completed. -
4. Re: create modal panel dinamically
eminil Oct 8, 2007 5:22 AM (in response to kgoedert)How do you actually show the modal panel from the backing bean?
Suppose you have a method in the bean, and that method returns and error, and you wish to show that in a modal panel. So you want to open the modal panel from within the backing bean method.