Q:

How to change the label style of the disabled items from selectCheckboxMenu?

My p:selectCheckboxMenu automatically changes the box style when itemDisabled is true as you can see below. However, I would like the itemLabel style changes as well for disabled items. How to do that?

<p:selectCheckboxMenu
    id="horario"
    value="#{clienteMB.horariosSelecionados}"
    label="Selecione"
    filter="true"
    filterMatchMode="startsWith"
    required="true"
    requiredMessage="Horário: campo obrigatório."
    converter="MultiSelectEntityConverter"
    style="width:100% !important">
    <f:selectItems
        itemDisabled="#{not empty consulta.datamarc}"
        value="#{clienteMB.horarioList}"
        var="consulta"
        itemLabel="#{consulta.dataHoraFormatted()}"
        itemValue="#{consulta}">
    </f:selectItems>
</p:selectCheckboxMenu>

PS.: with p:selectManyMenu, I don't have this problem.

A:

I could solve my problem using jQuery.
function changeDisabledItemColor() {
    jQuery("div.ui-chkbox-box.ui-widget.ui-corner-all.ui-state-default.ui-state-disabled").parent().parent().find('label').each(function(index) {
        jQuery(this).css('opacity','0.35');
    });
}

Once I have included changeDisabledItemColor() function, I just needed to add onShow="changeDisabledItemColor()" to p:selectCheckboxMenu.
This is the result:

