我遇到了這個問題,使用對話框顯示DataTable中所選行的數據。查看所選行的數據從<p:dataTable>到<p:dialog>
每個,即時通訊在對話
選擇顯示第一頂行(父行)的數據刪除其它行正常工作行。我一直在爲此工作,但仍無法解決這個問題。
這裏是我的DataTable中
代碼<h:form id="tableForm">
<!-- Account Data Table -->
<p:dataTable id="table" var="account" value="#{accountController.accounts}" widgetVar="accountTable" rowKey="#{account.id}" paginator="true" rows="15"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}" selection="#{accountController.account}"
paginatorPosition="bottom" lazy="true">
<p:column selectionMode="single" style="width:18px" />
<p:column headerText="Lastname" sortBy="#{account.marketingPerson.lastName}">
<h:outputText value="#{account.marketingPerson.lastName}" />
</p:column>
<p:column headerText="Firstname" sortBy="#{account.marketingPerson.firstName}">
<h:outputText value="#{account.marketingPerson.firstName}" />
</p:column>
<p:column headerText="Middlename" sortBy="#{account.marketingPerson.middleName}">
<h:outputText value="#{account.marketingPerson.middleName}" />
</p:column>
<p:column headerText="Position">
<h:outputText value="#{account.marketingPerson.position}" />
</p:column>
<f:facet name="footer">
<!-- View Button -->
<p:commandButton value="View" oncomplete="view.show()" icon="view-icon" >
<f:setPropertyActionListener target="#{accountController.account}" value="#{account}"/>
</p:commandButton>
<!-- Edit Button -->
<p:commandButton value="Edit" onclick="view.show()" icon="edit-icon">
</p:commandButton>
<!-- Delete Button -->
<p:commandButton value="Delete" onclick="cd.show()" icon="delete-icon" >
<f:setPropertyActionListener target="#{accountController.account}" value="#{account}" />
</p:commandButton>
</f:facet>
</p:dataTable>
<!-- Confirmation -->
<p:confirmDialog
header="Delete Action Confirmation" severity="alert"
widgetVar="cd">
<f:facet name="message">
<h:outputText value="Are you sure?" />
</f:facet>
<p:commandButton value="Yes" actionListener="#{accountController.delete}" update="table"
oncomplete="cd.hide()">
<f:ajax render="table" />
</p:commandButton>
<p:commandButton value="No" onclick="cd.hide()" type="button" />
</p:confirmDialog>
</h:form>
查看帳戶對話框
<p:dialog header="View Account" widgetVar="view" resizable="false" id="viewDlg" draggable="false" >
<h:form id="viewForm">
<p:panelGrid id="display" columns="2" style="margin:0 auto;">
<f:facet name="header">
<p> <h:graphicImage value="resources/images/icons-button/search_business_user.png" />
#{account.marketingPerson.lastName}, #{account.marketingPerson.firstName} #{account.marketingPerson.middleName}
</p>
</f:facet>
<p:outputLabel value="ID Number:" />
<p:outputLabel value="#{account.marketingPerson.idNumber}" />
<p:outputLabel value="Birth Date:" />
<p:outputLabel value="#{account.marketingPerson.birthDate}" />
<p:outputLabel value="Telephone Number:" />
<p:outputLabel value="#{account.marketingPerson.telNumber}" />
<p:outputLabel value="Mobile Number:" />
<p:outputLabel value="#{account.marketingPerson.mobileNumber}" />
<p:outputLabel value="Email Address:" />
<p:outputLabel value="#{account.marketingPerson.emailAddress}" />
<f:facet name="footer">
<p:commandButton type="button" value="Edit" />
</f:facet>
</p:panelGrid>
</h:form>
</p:dialog>
你好zaidoRed:您還沒有更新您的視圖對話框,從中'
'。你可以嘗試更新'查看'按鈕點擊查看對話框。 – Diganta
即時通訊與此識別錯誤。嘗試
– tddiaz
你可以刪除你的''並放置你的'視圖對話框'在你的''?如果你沒有這個限制,如果可以的話可以添加'update ='屬性:tableForm:display'' –
Diganta