-
1. Re: follow up of java and js functions
sergeysmirnov Sep 2, 2008 5:49 PM (in response to janson12)You can reRender JSF component, not just a div. So, you < a4j:outputPanel layout="block" > . It generate exactly div.
The rest ones are simple:a4j:support data="#{foo.bar}" oncomplete="js_func(data.something, data.somethingelse)" reRender="outputPanel_id"
-
2. Re: follow up of java and js functions
janson12 Sep 3, 2008 4:40 AM (in response to janson12)Thanks for the response Sergey. Meanwhile I've found a workaround via EL. Just in case someone wnats to do smth similar here's the scenario:
The user is shown a table with document items the he can download by selecting each one over a checkbox. underneath the table he can chose to download the selected items as a zip file. first step is to get the id's of the selected elements (java-function). after that a javascript function is called that opens a popup/download dialogue but just in case any item has been selected . first i tried to check this with a js-function (BEFORE rerender as all boxes would get unmarked then). BUT...wonderful EL provides the means to pass a java variable (1=at least one checkbox has been selected, -1 none has been selected, initialized when detecting the items' ids) to the js-function. Finnaly the whole stuff looks like that:<a4j:commandButton value="#{mailbox_msg.label_download}" action="#{MailboxBean.prepareZip}" styleClass="buttonStyle" reRender="inboxTable, messages" oncomplete="doConditionalPopup('protected/pages/mailbox/export.jsp', '#{MailboxBean.filesCheck}')"/>
So, there's just one question left after having read your snippet: what is the data-attribute actually doing?
thanks a lot for inspiring! -
3. Re: follow up of java and js functions
nbelaevski Sep 3, 2008 3:01 PM (in response to janson12)Hi,
"data" attribute is used to set some useful payload to use in oncomplete.