0

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

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
codyLine
  • 509
  • 2
  • 8
  • 26

1 Answers1

-2

Use a <c:forEach> instead of <p:repeat> so that you can get a handle to the generated ID's within the loop and then work with them. For more details : JSTL in JSF2 Facelets... makes sense?

AmeyK
  • 21
  • 2