-
1. Re: Include modalpanel contents similiar a4j:include
nbelaevski Mar 10, 2009 8:59 AM (in response to wark2007)Hello,
Yes, this is possible. Re-render contents of modal panel before show and show it by oncomplete (this example doesn't show how to re-render: http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?tab=editDataTable, but it's very easy to add it). -
2. Re: Include modalpanel contents similiar a4j:include
wark2007 Mar 10, 2009 9:45 AM (in response to wark2007)Hi, thank you for your quick response! I guess my explanation wasn't that good. I didn't mean with content of a modalpanel some information about a result set but the whole html content inside the modalpanel component.
One example: You have one html page with information about cars. On that page you have a lot of different modalpanels, one for creating a new car, one for editing a car, one for deleting a car, one modalpanel with technical information about the car, one modalpanel with information about finance and so on.
Consider that each modalpanel contains a lot of html code, than your browser needs to fetch and render a lot of html code although the user doesn't need it (at least for the first http request). The contents are only required if the user clicks that special button or link which shows the modalpanel. My aim was that the complete contents of the modal panel will be fetched in an ajax request like it works for a4j:include.
Unfortunately, I didn't know how to use a4j:include inside a modalpanel to meet the above described requirements.
Thanks and regards! -
3. Re: Include modalpanel contents similiar a4j:include
ilya_shaikovsky Mar 10, 2009 9:53 AM (in response to wark2007)it's pretty simple. You define something like
<a4j:outputPanel id="content"> <ui:include scr="#{myBean.pageSrc}"/> </a4j:outputPanel>
inside your modal panel.
Then you just use the button like this<a4j:commandButton reRender="content" action="#{myBean.setEditSrc"} oncomplete="Modal calling JS API here"/> <a4j:commandButton reRender="content" action="#{myBean.setRemoveSrc"} oncomplete="Modal calling JS API here"/>
So after you hit some button - src for include will be changed from action. ModalPanel content will be updated on the client via reRender. And finally the panel you need will be shown.