如何导出与 JSF Primefaces 中的 UI 不同的数据 table?
How to export a data table as different from the UI in JSF Primefaces?
我有一个数据 table,我想将其导出为与 UI 不同的数据。
比如我的部分数据table是
<p:column sortBy="#{phi.patProtein}" width="130">
<f:facet name="header">
<h:outputText value="Pathogen Protein" />
</f:facet>
<h:outputText id="patProteinText" value="#{phi.patProtein}" />
<p:commandLink id="patBtn" value="[+]" type="button" />
<p:overlayPanel for="patBtn" hideEffect="fade" dynamic="true"">
<h:outputText value="#{phi.patProteinLong}"/>
</p:overlayPanel>
</p:column>
我只想从列中导出输出文本 ("#{phi.patProtein}"
),而不是命令 link ("[+]"
) 和覆盖面板。但是 Primefaces 导出列中的所有内容,并且没有给我机会指定要导出的列的哪些字段。
我该怎么做?
如果您创建两个 <p:column>
,一个包含 <h:outputText>
,另一个包含 <p:commandLink>
和 <p:overlaypanel>
,您可以设置属性 [=第二列的 15=] 到 false
:
<p:column sortBy="#{phi.patProtein}" width="130">
<f:facet name="header">
<h:outputText value="Pathogen Protein" />
</f:facet>
<h:outputText id="patProteinText" value="#{phi.patProtein}" />
</p:column>
<p:column exportable="false">
<p:commandLink id="patBtn" value="[+]" type="button" />
<p:overlayPanel for="patBtn" hideEffect="fade" dynamic="true"">
<h:outputText value="#{phi.patProteinLong}"/>
</p:overlayPanel>
</p:column>
那么只导出文本。
我有一个数据 table,我想将其导出为与 UI 不同的数据。
比如我的部分数据table是
<p:column sortBy="#{phi.patProtein}" width="130">
<f:facet name="header">
<h:outputText value="Pathogen Protein" />
</f:facet>
<h:outputText id="patProteinText" value="#{phi.patProtein}" />
<p:commandLink id="patBtn" value="[+]" type="button" />
<p:overlayPanel for="patBtn" hideEffect="fade" dynamic="true"">
<h:outputText value="#{phi.patProteinLong}"/>
</p:overlayPanel>
</p:column>
我只想从列中导出输出文本 ("#{phi.patProtein}"
),而不是命令 link ("[+]"
) 和覆盖面板。但是 Primefaces 导出列中的所有内容,并且没有给我机会指定要导出的列的哪些字段。
我该怎么做?
如果您创建两个 <p:column>
,一个包含 <h:outputText>
,另一个包含 <p:commandLink>
和 <p:overlaypanel>
,您可以设置属性 [=第二列的 15=] 到 false
:
<p:column sortBy="#{phi.patProtein}" width="130">
<f:facet name="header">
<h:outputText value="Pathogen Protein" />
</f:facet>
<h:outputText id="patProteinText" value="#{phi.patProtein}" />
</p:column>
<p:column exportable="false">
<p:commandLink id="patBtn" value="[+]" type="button" />
<p:overlayPanel for="patBtn" hideEffect="fade" dynamic="true"">
<h:outputText value="#{phi.patProteinLong}"/>
</p:overlayPanel>
</p:column>
那么只导出文本。