multiple selects in 'selectManyCheckbox'

UI Components for JSF
Post Reply
NOTiFY
Posts: 393
Joined: 25 May 2016, 22:57

30 Sep 2016, 10:04

I'm dynamically creating a 'selectManyCheckbox'

Code: Select all

<p:selectManyCheckbox value="#{categoriesBean.selectedBrands}" id="brand#{brand}">
    <f:selectItems value="#{categoriesBean.brands}" var="brand" itemLabel="#{brand}" itemValue="#{brand}"/>
    <p:ajax pdate="growlFilter" listener="#{categoriesBean.clickedBrands}" update=":tabHomeView:formProducts:dataTableProducts" /></p:selectManyCheckbox>
However when I select any of the items in the 'selectManyCheckbox' I only get the one value passed (the one I've just clicked) and not the 'null/empty' unchecked checkboxes. Or when I check/click a second one, without unchecking the first I don't get two passed, only the last one clicked.

The JBoss log shows the one brand I selected "Topeak" and not the false for the other three brands in the 'selectManyCheckbox':

08:40:52,727 INFO [com.nohagl.ejb.CategoriesBean] (default task-32) ********** setSelectedBrands = 1
08:40:52,727 INFO [com.nohagl.ejb.CategoriesBean] (default task-32) >>>>> setSelectedBrands = 1
08:40:52,727 INFO [com.nohagl.ejb.CategoriesBean] (default task-32) >>>>> selectedBrands = Topeak

Can't see any settings listed in the documentation or in the Showcase example.

How do I get the 'selectManyCheckbox' to pass the complete (String) array?
PF 13.0.0--Jakarta. Jakarta Faces 4.0.1/Kotlin Multiplatform 1.9.10
Mojarra 4.0.2, OmniFaces 4.2
WildFly 29.0.1.Final 'preview' Jakarta EE 10.0.0
JDK 20.0.2, Kotlin 1.9.10, Gradle 8.3 Groovy DSL, MongoDB 7.0.0
IntelliJ IDEA 2023.2.1, macOS Ventura 13.5.1

NOTiFY
Posts: 393
Joined: 25 May 2016, 22:57

03 Oct 2016, 23:42

The only way I could get it work was use:

Code: Select all

 <p:commandLink value="Submit" .....
This is not ideal as I rather have the change happen "on-click" rather than "on-click, submit".
PF 13.0.0--Jakarta. Jakarta Faces 4.0.1/Kotlin Multiplatform 1.9.10
Mojarra 4.0.2, OmniFaces 4.2
WildFly 29.0.1.Final 'preview' Jakarta EE 10.0.0
JDK 20.0.2, Kotlin 1.9.10, Gradle 8.3 Groovy DSL, MongoDB 7.0.0
IntelliJ IDEA 2023.2.1, macOS Ventura 13.5.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Majestic-12 [Bot] and 30 guests