小编Bor*_*ris的帖子

截断p:dataTable中的大文本值并使用全文导出表

我使用Primefaces 3.5与JSF 2,并有一个dataTable:

<p:dataTable id="dataTable" var="refType"
        value="#{rtmUiController.listAllRefTypes()}" paginator="true"
        rows="10" filteredValue="#{rtmUiController.filteredRefTypes}"
        paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
        rowsPerPageTemplate="10,25,50,100" resizableColumns="true"
        emptyMessage="No reference type found.">
Run Code Online (Sandbox Code Playgroud)

该表包含以下具有大文本描述的列,该列当前被内联截断并显示在链接旁边以弹出具有全文的对话框:

    <p:column filterBy="#{refType.description}"
            filterMatchMode="contains">
            <f:facet name="header">
                <h:outputText value="Description" />
            </f:facet>
            <h:outputText value="#{refType.description.substring(30)}" />
            <p:commandLink id="descriptionLink" value="... (full text)"
                oncomplete="descriptionDialog.show()"
                update=":tabView:form1:descriptionPanel"
                rendered="#{not empty refType.description}">
                <f:setPropertyActionListener value="#{refType.description}"
                    target="#{flash.description}" />
            </p:commandLink>
    </p:column>

    <p:dialog widgetVar="descriptionDialog" resizable="false"
        header="Reference Type Description">
        <p:panelGrid id="descriptionPanel" columns="1">
            <h:outputText id="description" value="#{flash.description}" />
        </p:panelGrid>
    </p:dialog>
Run Code Online (Sandbox Code Playgroud)

现在的问题是使用showcase中的标准primefaces dataExporter功能将具有全文值的表导出为PDF或任何其他格式,因为它只导出表的确切内容:

    <h:panelGrid>
        <p:panel header="Export Table Data">
            <h:commandLink>
                <p:graphicImage id="pdfImage" value="/resources/images/pdf.png" />
                <p:dataExporter …
Run Code Online (Sandbox Code Playgroud)

css primefaces jsf-2

2
推荐指数
1
解决办法
7364
查看次数

标签 统计

css ×1

jsf-2 ×1

primefaces ×1