How to make Item only appear when category code = 1

0

I have the following code

<h:selectOneRadio value="#{solicitacaoImpressaoBean.entrega.tipoGuia}" class="tipoGuia">
    <f:selectItems value="#{solicitacaoImpressaoBean.tipoGuia}" var="guia" 
                itemLabel="#{guia.descricao}" itemValue="#{guia}" />
</h:selectOneRadio>

which does the following:

Iwouldlikewhenthecategorycodewas1didnotrendertheitemthatisembargo

somethinglike

rendered="#{not solicitacaoImpressaoBean.entrega.peg.categoria.codigo eq 1}"

but how to do this in a selectOneRadio?

    
asked by anonymous 23.01.2018 / 19:20

2 answers

0

I was able to disable the item by doing itemDisabled="# {RequestImpressaoBean.entrega.peg.category.codigo eq 1 and guia.codigo eq 3}"

com css <style> .tipoGuia input:disabled , .tipoGuia input:disabled ~ label {display:none} </style> 

I added with the item in question.

    
31.01.2018 / 12:53
0

A simple way to do this is in the construct that returns the list of type Guide, in the BackBean you can check that the category is 1 and not include embargo in the list.

To do this in the part of the screen could use selectItem (instead of selectItems) and (assuming they are only 3) could put the itemDisabled using the category condition in a manner similar to rendered:

 <f:selectItem itemValue="2" itemLabel="embargo" itemDisabled="#{not solicitacaoImpressaoBean.entrega.peg.categoria.codigo eq 1}" />
    
23.01.2018 / 20:57