a4j:commandbutton oncomplete not closing the popuppanel in 4.5.16.Final?
sivaprasad9394 Jun 13, 2016 12:53 AMHi,
In my page i have Export as Excel link at the outside datatable.
<a4j:commandLink value="Export as Excel"
rendered="#{reporting.selectedTab.equals('shortIdSearch')}"
action="#{reporting.generateExcelByShortID()}"
oncomplete="if(#{facesContext. maximumSeverity==null}) {#{rich:component('confirmExcelModel')}.show();}"/>
Here i am showing an popup,Inside popup which tells - Excel API only supports 65,535 rows.Would you like to download first 65,535 rows?
I have tried with 2 options for downloading the excel file using jxl API.
1.Normal a4j:commandButton -- Able to download excel file but oncomplete popup is not closing.
2.Seam WebRemoting - Not calling the backing bean.But popup is not closing and loading image is also not closing on oncomplete method.
Added below code in the .xhtml page:
<script type="text/javascript" src="seam/resource/remoting/resource/remote.js"></script>
<script type="text/javascript" src="seam/resource/remoting/interface.js?reporting"></script>
<s:remote type="text/javascript" include="reporting"/>
<a4j:region id="popupExcelRegion">
<rich:popupPanel id="confirmExcelModel" autosized="true" modal="true" domElementAttachment="parent">
<f:facet name="header">
<h:outputText value="Excel only supports..." />
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<h:graphicImage value="/img/close.png" id="hidelinkDelete"
styleClass="hidelink">
<rich:componentControl target="confirmExcelModel" operation="hide"
event="click" />
</h:graphicImage>
</h:panelGroup>
</f:facet>
<h:form id="confirmExcelForm" onsubmit="return false;">
<a4j:region id="confirmExcelModelRegion">
<a4j:outputPanel id="popupExcelpanel" ajaxRendered="true">
<h:messages/>
<rich:messages/>
<div align="center">
<h:graphicImage value="/img/msgwarn.png" />
<h:outputText
value="Excel API only supports 65,535 rows.Would you like to download first 65,535 rows?" escape="false" />
<h:panelGrid columns="2">
<button type="button" onclick="downloadExcel();">Yes</button>
<a4j:commandButton value="Yes" action="#{reporting.generateExcelLimitedByShortIDNew}"
execute="@form" render="@form"
oncomplete="if(#{facesContext.maximumSeverity==null})#{rich:component('confirmExcelModel')}.hide();">
</a4j:commandButton>
<a4j:commandButton size="20" value="No" status="statusExcelIDs"
onclick="#{rich:component('confirmExcelModel')}.hide();return false;" />
</h:panelGrid>
</div>
</a4j:outputPanel>
</a4j:region>
</h:form>
</rich:popupPanel>
</a4j:region>
<script type="text/javascript">
function downloadExcel() {
Seam.Component.getInstance("reporting").generateExcel('help',closeExcelpopUp); //Not even calling backing bean method "generateExcel()"
}
function closeExcelpopUp() {
Richfaces.hidePopupPanel("confirmExcelModel");
}
</script>
Backing bean class:
@Name("reporting")
@Scope(ScopeType.CONVERSATION)
public class Reporting {
......
.............
@WebRemote
public String generateExcel(String helpValue) {
this.shortIdReportExcel = null;
if(this.shortIdReport.size()>65534){
this.shortIdReportExcel= this.shortIdReport.subList(0, 65532);
}else {
this.shortIdReportExcel= this.shortIdReport;
}
return "/layout/shortid-excel.xhtml";
}
public String generateExcelLimitedByShortIDNew() {
this.shortIdReportExcel = null;
if(this.shortIdReport.size()>65534){
this.shortIdReportExcel= this.shortIdReport.subList(0, 65532);
}else {
this.shortIdReportExcel= this.shortIdReport;
}
return "/layout/shortid-excel.xhtml";
}
}
By Implementing the below code popup is closed.But after downloading the excel file ,I cannot do any click operations and nothings i can do in the screeen.Looks like screen is locked?
<a4j:commandButton value="Yes" action="#{reporting.generateExcelLimitedByShortIDNew}" status="statusExcelIDs"
execute="@form" render="@form"
onbegin="#{rich:component('confirmExcelModel')}.hide();">
</a4j:commandButton>
Looks like this CORE RF BUG in the version?