我有这样的结构:
<p:treeTable value="#{cmpDocumentTree.root}" var="v" id="#{tableId}" selectionMode="single"
selection="#{cmpDocumentTree.selectedNode}">
<p:ajax event="expand" listener="#{cmpDocumentTree.onNodeExpand}" />
<p:ajax event="collapse" listener="#{cmpDocumentTree.onNodeCollapse}" />
<p:ajax event="select" listener="#{crudBean.edit(cmpDocumentTree.selectedNode.data)}"
update=":#{formDialogUpdate}" oncomplete="#{formDialog}.show()" />
<p:column headerText="Nazwa" sortBy="#{v.name}" style="min-width: 200px;">
<h:outputText value="#{v.name}" />
</p:column>
<p:column headerText="Pliki" width="300">
<ui:repeat var="_file1" value="#{v.files}">
<h:commandLink value="#{_file1.originalFilename}">
<p:fileDownload
value="#{fileDownloadController.getFile(_file1.originalFilename, _file1.storedFilename, _file1.contentType)}" />
</h:commandLink>
<br />
</ui:repeat>
</p:column>
</p:treeTable>
但是 - p:fileDownload 不起作用。fileDownloadController.getFile(...) 方法根本没有被触发。当我将相同的方法放在 p:dataTable 中时,它可以完美运行。
编辑:
v.files 来自 ComDocument 实体 - 它是一对多文档到文件的关系。
@Entity
@Table(name = "com_documents", schema = "public")
@SequenceGenerator(name = "COM_DOCUMENTS_SEQ", sequenceName = "COM_DOCUMENTS_SEQ", allocationSize = 1)
public class ComDocument implements EntityInt, java.io.Serializable {
(...)
@OneToMany(fetch = FetchType.EAGER, mappedBy = "document", cascade = CascadeType.ALL, orphanRemoval = true)
private List<ComDocumentFile> files;
public void setFiles(List<ComDocumentFile> files) {
this.files = files;
}
public List<ComDocumentFile> getFiles() {
return files;
}
你可以帮帮我吗?谢谢。