0

We have a dynamic size of selectOneMenu components in the view.

view example:

choose color [yellow, blue,....]

choose size [80cm, 120cm....]

the structure is simple: (PON) productOptionName Object (color, Size, ....) (POV) productOptionValue Object with a relation to productOptionName (yellow, blue ...) (POM) productOptionMapping Object (pon.id, pov.id, article.id, amount)

we build the following structure for the view, to iterate simple over the object structre Tree:

pon - list_pov - pom

e.g:

color - yellow - pom [pon.id, pov.id, article.id, amount)

color - blue - pom [pon.id, pov.id, article.id, amount)

size - 80 - pom[pon.id, pov.id, article.id, amount)

size - 120 - pom[pon.id, pov.id, article.id, amount)

in the view we iterate the pon:

<ui:repeat var="pon" value="#{bean.src_list}".....
  #{pon.name}<br/>
  <h:selectOneMenu value="#{bean.selected_pom_list}"...
    <f:selectItems var="pov" value="{pon.lst_pov}" itemLabel="#{pov.value_name}" itemValue="#{pov.pom}"

the problem is: we cant add the selected POM Object (value="#{bean.selected_pom_list}") to a list (sure, it's a "selectOneMenu" Component)

has someone some hints, how to go here ? (cos, we cant add "100 selected_variables.... and also need the preselect function)

thanks a lot!

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Sence
  • 115
  • 8
  • Just use a list or array like `src_list`? It's so much more straightforward if you replace `#{bean.selected_pom_list}` by `#{pon.selected_pom_list}` – BalusC Feb 09 '14 at 09:22
  • have to correct my self: we cant add the itemValue="#{pov.pom}" to a list. We get the following exception: Cannot coerce package.ProductOptionMapping to interface java.util.List (incompatible type). With your hint, we have to iterate all pon objects and then check for pom. If we could directly add the pom in a list its easier to read and less iterations. i think i will accomplish the job like this: selected_pom Object with ajax listener, which add the selected pom object to the list. The preselection will be done by jquery (write the pom.ids in a hidden input field and let jquery preselect em) – Sence Feb 09 '14 at 10:32

0 Answers0