0

I have many lines (in a table).
In the first line I have three selectOneMenu:

  1. the first contains the names of continents
  2. the second contains the names of towns (depending on the continent selected in the first selectOneMenu)
  3. the third one contains the names of villages (which depends on the tows selectd in the second selectOneMenu)

In the second line and the next ones, it is the same three selectOneMenu but with others values.

All these selectOneMenu uses converters. like this

<p:selectOneMenu id="id" value="#{xValue}"  converter="xConverter" >
    <f:selectItem itemLabel="-----"  />
    <f:selectItems value="#{lstItemsForSelectOneMenu}" />
    <p:ajax event="valueChange" listener="#{xChange()}" update="thingsToUpdate"/>
</p:selectOneMenu>

My problem is that the converter xConverter is executed before the method xChange().

The following example explains why it is a problem for me:

if the user chooses in the first line:
1.Continent : America 2. Town: Washington 3. Village: Baltimore
and in the second one he chooses
1.Continent : Africa 2. Town: Tunisia 3. Village: Sfax

After selecting Sfax he returns immediately to the first line in the second selectOneMenu, in this case how can the system knows that the user hase selected the selectOneMenu of the first line in the converter ?

Thanks

Fritz
  • 9,987
  • 4
  • 30
  • 49
ktaria
  • 423
  • 6
  • 16
  • The converters are executed when a component is going to be rendered, because they support the renderization of the options and allows the jump from a selected item to the actual object it represents and vice-versa. If that's happening, it's probably because your third `selectOneMenu` is updating/rendering the previous one. Are you rendering the second menu with a `` when selecting a new value for the third one too?. – Fritz Apr 12 '13 at 17:29
  • Yes the third selectOneMenu depends on the value of the second one – ktaria Apr 12 '13 at 20:12
  • @Gamb asks what are you exactly updating in your ajax call. Can you put the code of the whole table? It's very dificult to see the issue if you only give a `selectOneMenu` tag example. – Aritz Apr 14 '13 at 21:35
  • Thanks I found the solution in [How do I pass a parameter value to a Conversion class in java?][1] [1]: http://stackoverflow.com/questions/6930994/how-do-i-pass-a-parameter-value-to-a-conversion-class-in-java – ktaria Apr 18 '13 at 16:45

0 Answers0