I am trying to change the style of p:selectCheckboxMenu when user has selected any values from dropdown. For example change the background color of the label container (
.ui-selectcheckboxmenu .ui-selectcheckboxmenu-label-container
) or the color of the border.
The issue I have is that the selectCheckboxMenus are generated dynamically inside a repeat component.
<h:panelGroup id="multiple" >
<p:repeat value="#{myBean.keywdLst}" var="kLst" >
<p:selectCheckboxMenu id="checkmenu" value="#{myBean.selectedKeywords}"
label="#{kLst.keywordlistname}" filter="true" filterMatchMode="startsWith"
panelStyle="width:250px" valueChangeListener="#{myBean.selectedItemsChanged}" >
<f:selectItems value="#{kLst.listKeywords}" var="key" itemLabel="#{key.keyword}" itemValue="#{key}" />
</p:selectCheckboxMenu>
</p:repeat>
</h:panelGroup>
I'm not sure about the right approach to tackle this problem. Whether with javascript and ajax listener or in backing bean, the challenge is to get the id only of the selectCheckboxMenus with selected items and some how push a css code there.
Any help is highly appreciated.
Thanks