[英]commandButton update attribute not working
我有一個commandButton,它將打開一個包含表的對話框。
單擊該按鈕時,將彈出對話框,但其中不包含任何內容。
這是我的代碼:
<h:panelGroup id="correctionsEntries" layout="block">
<p:dataTable styleClass="dataTable" id="entriesTable" var="entry" value="#{bean.tableModel.items}">
<p:columnGroup type="header">
<p:row>
<ui:repeat var="column" value="#{bean.tableModel.columns}" varStatus="colStatus">
<p:column headerText="#{column.header}">
</p:column>
</ui:repeat>
</p:row>
</p:columnGroup>
<c:forEach var="column" items="#{bean.tableModel.columns}">
<c:choose>
<c:when test="${column.header eq 'Upload'}">
<p:column>
<p:commandButton value="Upload" immediate="true" actionListener="#{bean.setSelectedRow(entry)}" oncomplete="PF('upload').show();" />
<p:dialog header="Upload" widgetVar="upload" height="10%" width="80%">
<p:messages binding="#{bean.component}" />
<p:fileUpload fileUploadListener="#{bean.uploadCSV}" />
</p:dialog>
</p:column>
</c:when>
<c:when test="${column.header eq 'Export'}">
<p:column>
<p:commandButton value="Download" immediate="true" ajax="false" actionListener="#{bean.setSelectedRow(entry)}">
<p:fileDownload value="#{bean.downloadCSV()}" />
</p:commandButton>
</p:column>
</c:when>
<c:when test="${column.header eq 'Display'}">
<p:column>
<p:commandButton id="displayButton" value="Display"
immediate="true"
action="#{tableBean.execute(entry)}"
update="displayTable"
oncomplete="PF('dialog').show();" />
<p:dialog id="dialog" header="Current data" widgetVar="dialog" height="80%" width="80%">
<p:dataTable styleClass="dataTable"
id="displayTable" var="tableDataVar"
value="#{tableBean.tableModel.data}"
tableStyle="width:auto;" resizableColumns="true">
<p:columns var="tableHeader" value="#{tableBean.tableModel.headers}">
<f:facet name="header">
<h:outputText value="#{tableHeader}" />
</f:facet>
<h:outputText value="#{tableDataVar[tableHeader]}" />
</p:columns>
</p:dataTable>
</p:dialog>
</p:column>
</c:when>
<c:when test="${column.header eq 'Test'}">
<p:column>
<p:commandButton value="Test" immediate="true" ajax="false" actionListener="#{bean.setSelectedRow(entry)}">
<p:fileDownload value="#{bean.testFilesDownload()}" />
</p:commandButton>
</p:column>
</c:when>
<c:otherwise>
<p:column>
<h:outputText value="#{bean.tableModel.get(entry, column)}" />
</p:column>
</c:otherwise>
</c:choose>
</c:forEach>
</p:dataTable>
</h:panelGroup>
該表僅在刷新頁面后顯示。
問題是為父表中的每個列創建了一個包含該表的對話框。
因此,對話框與列一樣多。
解決此問題的方法是以單獨的形式添加對話框,並通過指定其路徑在commandButton中對其進行引用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.