Hello, I have the following situation:
On my page jsf I have some selectBooleanCheckbox
components. I need that, when clicking on one of them some others are unmarked, and also disabled, making their selection impossible.
It's possible? If so, does anyone have any information, material that can help me? Thanks
xhtml:
<h:selectBooleanCheckbox value="#{simpleReport.colunaCliente}" />
<h:outputText escape="false" value="Cliente" />
<h:selectBooleanCheckbox value="#{simpleReport.colunaCondutor}" />
<h:outputText escape="false" value="Condutor" />
<h:selectBooleanCheckbox
value="#{simpleReport.colunaCondicaoTempo}" />
<h:outputText escape="false" value="Cond. Tempo" />
<h:selectBooleanCheckbox value="#{simpleReport.colunaOcorrencia}" />
<h:outputText escape="false" value="Ocorrência" />
No bean:
boolean colunaId = false, colunaCliente = false, colunaCondutor = false, colunaPeriodo = false,
colunaCondicaoTempo = false, colunaStatus = false, colunaOcorrencia = false, colunaSoma = false,
colunaQtdCond = false, colunaQtdCli = false;
Update01:
xhtml
<p:toolbarid="colunas" style="margin-top: 20px">
<p:toolbarGroup>
<h:selectBooleanCheckbox id="id" value="#{simpleReport.colunaId}" />
<h:outputText escape="false" value="Cód." />
<h:selectBooleanCheckbox id="cli"
value="#{simpleReport.colunaCliente}" />
<h:outputText escape="false" value="Cliente" />
<h:selectBooleanCheckbox id="cond"
value="#{simpleReport.colunaCondutor}" />
<h:outputText escape="false" value="Condutor" />
<h:selectBooleanCheckbox id="CondTemp"
value="#{simpleReport.colunaCondicaoTempo}" />
<h:outputText escape="false" value="Cond. Tempo" />
<h:selectBooleanCheckbox id="ocor"
value="#{simpleReport.colunaOcorrencia}" />
<h:outputText escape="false" value="Ocorrência" />
<h:selectBooleanCheckbox id="sta"
value="#{simpleReport.colunaStatus}" />
<h:outputText escape="false" value="Status" />
<h:selectBooleanCheckbox id="per"
value="#{simpleReport.colunaPeriodo}" />
<h:outputText escape="false" value="Período" />
<h:selectBooleanCheckbox id="soma"
value="#{simpleReport.colunaSoma}" />
<h:outputText escape="false" value="Soma" />
<h:selectBooleanCheckbox id="qtdCli"
value="#{simpleReport.colunaQtdCli}" />
<h:outputText escape="false" value="QtdCli" />
<h:selectBooleanCheckbox value="#{simpleReport.colunaQtdCondTemp}" />
<h:outputText escape="false" value="Qtd Cond Temp." />
</p:toolbarGroup>
</p:toolbar>
<p:toolbar style="margin-top: 20px">
<p:toolbarGroup>
<p:selectBooleanCheckbox id="groupCLiente"
value="#{simpleReport.groupByCLiente}">
<p:ajax update="id cond CondTemp ocor sta per"
listener="#{simpleReport.resetValue1}" />
<h:outputText escape="false" value="Cliente" />
</p:selectBooleanCheckbox>
<p:selectBooleanCheckbox id="groupCondicao"
value="#{simpleReport.groupByCondicaoTempo}">
<p:ajax update="id cond CondTemp ocor sta per"
listener="#{simpleReport.resetCondicaoTempo}" />
<h:outputText escape="false" value="Condição" />
</p:selectBooleanCheckbox>
</p:toolbarGroup>
</p:toolbar>
No bean:
public void resetValue1() {
this.colunaId = false;
this.colunaCondutor = false;
this.colunaCondicaoTempo = false;
this.colunaOcorrencia = false;
this.colunaStatus = false;
this.colunaPeriodo = false;
this.colunaSoma = false;
}
public void resetCondicaoTempo() {
this.colunaId = false;
this.colunaCondutor = false;
this.colunaOcorrencia = false;
this.colunaStatus = false;
this.colunaPeriodo = false;
this.colunaSoma = false;
}
public void resetCondutor() {
this.colunaId = false;
this.colunaCondicaoTempo = false;
this.colunaOcorrencia = false;
this.colunaStatus = false;
this.colunaPeriodo = false;
this.colunaSoma = false;
}
Update02:
xhtml:
<h:selectBooleanCheckbox id="id" value="#{simpleReport.colunaId}"
disabled="#{simpleReport.groupByCLiente || simpleReport.groupByCondicaoTempo}"
enabled="#{not simpleReport.groupByCLiente}"/>