我有一個包含兩列的數據表 - 標題和操作 標題從託管bean中的列表填充,並且對於列表中的每個標題,數據表具有名爲Confirm的按鈕在Action欄下。 當用戶單擊確認按鈕時,會顯示一個對話框,其中包含其他信息以及另一個名爲Submit的按鈕。禁用數據表中的特定按鈕,jsf
如果用戶點擊該對話框中的Submit按鈕,在backing bean中設置變量confirmDate,confirmDate的值不爲null,我需要禁用主數據表中Action列下的特定Confirm按鈕。現在,如果我禁用它,所有確認按鈕都會被禁用。如何禁用所選的確認按鈕。非常感謝你對此的幫助。
主數據表
<h:panelGrid id="notificationList" width="100%">
<h:panelGroup >
<p:dataTable var="dt" value="#
{myBean.listAll}" id="titles" rowKey="#{dt.id}">
<f:facet name="header">
<h:outputText value = "Title List"/>
</f:facet>
<p:column headerText ="Title">
<h:outputText value="#{dt.title}"/>
</p:column>
<p:column headerText="Action">
<p:commandButton id="nID"
value="Confirm"
oncomplete="myDialog.show();"
process="@this"
disabled= "#{not empty dt.confirmDate}
update="@form">
<f:setPropertyActionListener value="#{dt}" target="#
{myBean.selectedTitle}"/>
</p:commandButton>
</p:column>
</p:dataTable>
</h:panelGroup>
</h:panelGrid>
我相信你有什麼不對您的支持bean或您應用confirmDate的方式。你能發佈這些代碼片段嗎? – fischermatte
在託管bean中,我正在做一些類似於public void updateNotificationConfirmDate()的方法selectedNotification1.setConfirmDate((new Date(System.currentTimeMillis()))。toString()); if(selectedNotification1.getConfirmDate()== null) setUserChecked(false); else setUserChecked(true); }在彈出對話框中的按鈕上面的方法正在調用
– santa029