I would like my command link to achieve 2 goals after one click:
1. call a backing bean method in action attribute to fill the list of data to dump.
2. trigger data Exporter to download the data file.
Howeve this seems impossible.
I also tried to trigger programmatically with JQuery a commandButton that encapsulates data Exporter.
but it never went into effect.
So is my presumption reasonable? Thanks
Code: Select all
<p:dataTable id="myList" value="#{myBean.list}" >
....
<p:commandLink action="#{myBean.fillList}"
update="myPanel" oncomplete="$(button[id*='exporterLink']).submit();" />
<p:commandButton id="exporterLink" ajax="false" rendered="#{service.showExportLink}" oncomplete="alert('We will now trigger exporter...');"
widgetVar="exporterLink" styleClass="NoDisplay">
<p:dataExporter type="xls" target="myList" fileName="detailedServices" />
</p:commandButton>