我正在使用旧版本的PF(3.5),但我无法让DataExporter使用属性selectionOnly="true"
。
如果我没有设置该属性,一切正常,反之亦然我得到这个错误:
Caused by: javax.el.ELException: /WEB-INF/views/AreaRiservata/Clinipass/Malattia/malattiaScaricoMandatiTesoreria.xhtml @91,61 value="#{mandato.codCompagnia}": Cannot convert codCompagnia of type class java.lang.String to class java.lang.Integer
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114) ~[jsf-impl-2.1.13.jar:2.1.13]
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:186) ~[jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:174) ~[jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
at javax.faces.component.UIOutput.getValue(UIOutput.java:169) ~[jboss-jsf-api_2.1_spec-2.0.9.Final.jar:2.0.9.Final]
我的数据表看起来像这样:
<p:ajax event="rowSelectCheckbox" update=":formTable:buttons" />
<p:ajax event="rowUnselectCheckbox" update=":formTable:buttons" />
<p:ajax event="toggleSelect" update=":formTable:buttons" />
<p:ajax event="rowSelect" update=":formTable:buttons" />
<p:ajax event="rowUnselect" update=":formTable:buttons" />
<p:column selectionMode="multiple" style="width:16px;text-align:center"/>
<p:column filterMaxLength="4" filterBy="#{mandato.codCompagnia}" sortBy="#{mandato.codCompagnia}" width="75" id="amala">
<f:facet name="header">
<h:outputText value="Compagnia" />
</f:facet>
<h:outputText value="#{mandato.codCompagnia}" />
</p:column>
<p:column filterBy="#{mandato.codProdotto}" sortBy="#{mandato.codProdotto}" width="75">
<f:facet name="header">
<h:outputText value="Prodotto" />
</f:facet>
<h:outputText value="#{mandato.codProdotto}" />
</p:column>
<p:column filterBy="#{mandato.annoSinistro}" sortBy="#{mandato.annoSinistro}" width="85">
<f:facet name="header">
<h:outputText value="Anno Sinistro" />
</f:facet>
<h:outputText value="#{mandato.annoSinistro}" />
</p:column>
<p:commandButton value="Crea file" ajax="false" icon="ui-icon-document">
<p:dataExporter type="csv" target="tableScaricoMandatiTesoreria" fileName="Mandati" selectionOnly="true" />
</p:commandButton>
答案 0 :(得分:0)
您错过了dataExporter组件
中的 postProcessor 属性 <p:dataExporter type="csv" target="tableScaricoMandatiTesoreria"
postProcessor="#{ExportCbean.postProcessXLS}" fileName="Mandati" selectionOnly="true" />
答案 1 :(得分:0)
这不是一个真正的修复,但我设法通过使用
创建另一个数据表来绕过这个问题id="tableScaricoMandatiTesoreriaSelected" style="display: none" value="#{malattiaScaricoMandatiTesoreriaModel.selectedMandati}"
然后我在另一张表中更改了ajax的更新:
<p:ajax event="rowSelectCheckbox" update=":formTable:buttons :formTable:tableScaricoMandatiTesoreriaSelected" />
<p:ajax event="rowUnselectCheckbox" update=":formTable:buttons :formTable:tableScaricoMandatiTesoreriaSelected" />
<p:ajax event="toggleSelect" update=":formTable:buttons :formTable:tableScaricoMandatiTesoreriaSelected" />
<p:ajax event="rowSelect" update=":formTable:buttons :formTable:tableScaricoMandatiTesoreriaSelected" />
<p:ajax event="rowUnselect" update=":formTable:buttons :formTable:tableScaricoMandatiTesoreriaSelected" />
出口商现在指向新表:
<p:dataExporter type="xls" target="tableScaricoMandatiTesoreriaSelected" fileName="Mandati" />