-
1. Re: Opening a popup / Modal panel from Java code
alespio May 26, 2008 4:17 AM (in response to francis1970)"francis1970" wrote:
Hi all !
I have an action inside a column of a data table
<rich:column> <h:commandButton id="button1" action="#{dataItem.action}" style="font-size: 10px;" value="InCharge" </rich:column>
I need to open a pop-up or a a Modal panel from the "action" method. Can anybody give me a help how to do it ?
Thanks a lot
Francesco
Try this:
oncomplete="Richfaces.showModalPanel('your_panel_id')"
use action method to set panel content or do nothing. Where action terminate, the component raise oncomplete event
Good luck -
2. Re: Opening a popup / Modal panel from Java code
fabmars May 26, 2008 4:18 AM (in response to francis1970)Personally I made such things in my code in the past days and I managed using the simple examples here:
http://livedemo.exadel.com/richfaces-demo/richfaces/modalPanel.jsf?c=modalPanel -
3. Re: Opening a popup / Modal panel from Java code
francis1970 May 26, 2008 4:36 AM (in response to francis1970)Hello, thanks for your answer.
I have checked the examples from live-demo,bt they use JavaScript to manipulate the Panel.
I'd rather need to create the panel from Java code because I need to save the dataitem object on DB.
Something like:public void action() { HtmlModalPanel panel = new HtmlModalPanel(); // Display content // Persist dataItem object }
Has anybody managed to do it ?
thanks again
Francesco -
4. Re: Opening a popup / Modal panel from Java code
ilya_shaikovsky May 26, 2008 5:11 AM (in response to francis1970)just manipulate with showWhenRendered attribute. If you need the modal to be opened after it build in action - just set is to true.
-
5. Re: Opening a popup / Modal panel from Java code
ilya_shaikovsky May 26, 2008 5:11 AM (in response to francis1970)just manipulate with showWhenRendered attribute. If you need the modal to be opened after it build in action - just set it to true.
-
6. Re: Opening a popup / Modal panel from Java code
francis1970 May 26, 2008 5:41 AM (in response to francis1970)here I'm again.
Thanks, your suggestion works. Anyway there's a last weird thing :-(
The modal panel disappears in a few seconds after. I can see that it's not even draggable like in the livedemo.
The modal panel is very simple<rich:modalPanel id="mp"> <f:facet name="header"> <h:outputText value="Modal Panel Title" /> </f:facet> <h:outputText value="text here: " /> </rich:modalPanel>
and it's called like this :
onclick="javascript:Richfaces.showModalPanel('mp', {top:'10px', left:'10px',height:'400'});" value="#"
It's a IE bug or perhaps should I put the modal panel in a separate file ?
Thanks again and sorry for pestering so much !
Francesco -
8. Re: Opening a popup / Modal panel from Java code
francis1970 May 26, 2008 7:30 AM (in response to francis1970)Ah finally I got it working! ! ! !
<a4j:commandButton>
instead of <h:commandButton>
and oncomplete
instead of onclick
Thanks a lot again :-) :-)
Francesco