-
1. Re: Custom File Download with reRender using commandbutton
harnishg May 29, 2007 2:17 PM (in response to carlhowarth)Not to be all doom and gloom, but to my knowledge, there is no way for this to work.
When you generate the Excel file, you are corrupting the View State. IE: The function that generates the Excel output is probably using FacesContext.responseComplete().
It is the same problem I'm having for a month. However I'm using h:commandButton ... and trying to use a4j:support'ed drop downs afterwards ... and getting the Excel file gibberish then ... however if I use a4j:commandButton, I get the gibberish immediately.
If you are interested, this is what I wrote up:
http://jboss.com/index.html?module=bb&op=viewtopic&t=107693 -
2. Re: Custom File Download with reRender using commandbutton
alexsmirnov May 29, 2007 4:27 PM (in response to carlhowarth)This use-case must be divided ino two parts : update page content and open a Excel spreadshit. You can send ajax request by a4j component, and redirect to download generated file in a 'oncomplete' method.
-
3. Re: Custom File Download with reRender using commandbutton
harnishg May 29, 2007 5:25 PM (in response to carlhowarth)Is one not going to encounter the problem again when they click on another A4J command button?
If not, how exactly does this work ... something like:
<a4j:commandButtion actionListener="#{bean.Update}" oncomplete="#{bean.saveExcel}" /> -
4. Re: Custom File Download with reRender using commandbutton
ilya_shaikovsky May 30, 2007 5:24 AM (in response to carlhowarth)you need to define JS function to be called after request complete in oncomplete attribute.
-
5. Re: Custom File Download with reRender using commandbutton
harnishg May 30, 2007 10:50 AM (in response to carlhowarth)Right so something like:
<a4j:jsFunction name="saveExcel" actionListener="#{bean.saveExcel}" />
<a4j:commandButton actionListener="#{Bean.Update}" oncomplete="saveExcel();" /> -
6. Re: Custom File Download with reRender using commandbutton
carlhowarth Jun 1, 2007 7:10 AM (in response to carlhowarth)I've tried this approach, and unfortunately the same thing is happening - the table updates because of the rerender, however when the function runs, it still runs in an ajax request, therefore I'm presented with gobbledegook! :-(