Jsf 2 选择表行并调用行选择侦听器时的JSF disable按钮
情况很简单:我想在选中表行并且行选择侦听器决定隐藏它时禁用一个按钮(在bean中将布尔值设置为false)。以下是我的部分观点:Jsf 2 选择表行并调用行选择侦听器时的JSF disable按钮,jsf-2,primefaces,Jsf 2,Primefaces,情况很简单:我想在选中表行并且行选择侦听器决定隐藏它时禁用一个按钮(在bean中将布尔值设置为false)。以下是我的部分观点: <h:form id="report-configurator"> <p:panel> <p:outputPanel styleClass="normalText paragraph"> Configure the Templates, the Collections and
<h:form id="report-configurator">
<p:panel>
<p:outputPanel styleClass="normalText paragraph">
Configure the Templates, the Collections and the Variables (aka Form fields) for the reports.
Define and associate the core elements which are used in the reports.<br/>
[View, edit, add and associate]
</p:outputPanel>
<p:accordionPanel dynamic="true" cache="true" style="width:96%;margin:0 auto;" >
<p:tab title="Templates" titleStyleClass="accordionHeader">
<p:panelGrid columns="2" cellpadding="10" columnClasses="twoEqualColumns top-align, twoEqualColumns top-align">
<p:panel header="Registered Templates">
<p:dataTable id="imagetypes" var="cRImageType"
value="#{reportConfiguratorBean.getCRImageTypes()}"
rowKey="#{cRImageType.imTypeId}"
paginator="true"
paginatorAlwaysVisible="false"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="10,20,50"
sortMode="multiple"
rows="10"
filteredValue="#{reportConfiguratorBean.filteredCRImageTypes}"
selection="#{reportConfiguratorBean.selectedCRImageType}"
selectionMode="single" >
<p:ajax event="rowSelect" listener="#{reportConfiguratorBean.setSelectedRow}" update="deleteCommand1" />
<p:ajax event="rowUnselect" listener="#{reportConfiguratorBean.unsetSelectedRow}"/>
...
<f:facet name="footer">
<p:commandButton id="deleteCommand1" onclick="dlg5.show()"
value="Delete"
disabled="#{reportConfiguratorBean.renderedDeleteProtocol}"
update=":report-configurator:deleteSingleImageType" />
行选择侦听器可以工作,因为我可以按下按钮并删除所选行等等。我还可以看到它将变量“renderedeleteprotocol”设置为false。问题是按钮声明中“disabled”属性中的按钮没有得到bean响应
有什么想法吗 我认为解决办法是:
<p:commandButton id="associateCommand1" onclick="dlg7.show()"
value="Associate Collections"
update=":report-configurator:associateVariables"
disabled="#{not(reportConfiguratorBean.renderedDeleteProtocol)?'true':'false'}"
action="#{reportConfiguratorBean.setSelectedRow}"/>
<p:commandButton id="associateCommand1" onclick="dlg7.show()"
value="Associate Collections"
update=":report-configurator:associateVariables"
disabled="#{not(reportConfiguratorBean.renderedDeleteProtocol)?'true':'false'}"
action="#{reportConfiguratorBean.setSelectedRow}"/>