出口商不工作
Exporter doesn't work
我使用的是旧版本的 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>
您错过了 dataExporter 组件中的 postProcessor 属性
<p:dataExporter type="csv" target="tableScaricoMandatiTesoreria"
postProcessor="#{ExportCbean.postProcessXLS}" fileName="Mandati" selectionOnly="true" />
这不是一个真正的修复,但我已经通过创建另一个数据 table 和
设法绕过了这个问题
id="tableScaricoMandatiTesoreriaSelected" style="display: none" value="#{malattiaScaricoMandatiTesoreriaModel.selectedMandati}"
然后我在另一个 table 中更改了 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" />
导出器现在指向新的 table:
<p:dataExporter type="xls" target="tableScaricoMandatiTesoreriaSelected" fileName="Mandati" />
我使用的是旧版本的 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>
您错过了 dataExporter 组件中的 postProcessor 属性
<p:dataExporter type="csv" target="tableScaricoMandatiTesoreria"
postProcessor="#{ExportCbean.postProcessXLS}" fileName="Mandati" selectionOnly="true" />
这不是一个真正的修复,但我已经通过创建另一个数据 table 和
设法绕过了这个问题id="tableScaricoMandatiTesoreriaSelected" style="display: none" value="#{malattiaScaricoMandatiTesoreriaModel.selectedMandati}"
然后我在另一个 table 中更改了 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" />
导出器现在指向新的 table:
<p:dataExporter type="xls" target="tableScaricoMandatiTesoreriaSelected" fileName="Mandati" />