Question

during the migration from RichFaces 3 to 4, we are facing an unexpected behaviour of rich:tree element. We registered a selectionChangeListener which is supposed to include a facelet with h:inputText fields next to the tree depending on the new selection. The facelet is supposed to show detailed information on the selected node.

This works correctly when the first selection is made. However, when we select another node of the same type, the same facelet is included (which is correct in this case as the node type is the same), but the values of the previous node are displayed in the facelet, even though the object holding the value of the component is instantiated correctly.

Inspecting the log files revealed that the TreeSelectionChangeEvent is processed during the Apply Request Phase (2). During that phase, the object holding the textfield's value is updated correctly, but is changed back to the old value during Update Model Phase (4).

General question on this issue is: Is it correct that this event is processed during Apply Request Phase even though the immediate attribute of the tree is set to false? (I would have expected the event to be processed during Invoke Application Phase (5)) And, if this is correct behaviour, how could we circumvent the problem that the old value is restored?

Thanks for your suggestions in advance.

Was it helpful?

Solution

as much as I understood, during the Apply Request Phase, the listener-event is executed and you update fields which are also represented as h:inputFields in the currently rendered view?

During Update Model Phase, the data out of the original h:inputText overwrites the already made changes?

Without being able to test it out locally: With switchType="ajax" the rich:tree-component gives two attributes

  • execute and
  • render.

You want the facelet-part to re-render, but not the input values to be executed (because that's what the listener already did).

Assuming you use rich:tree in ajax switch-type, have you tried to set execute="@this" and render="<theFaceletComponent>"?

If the component id wasn't found, use :#{rich:clientId('<theFaceletComponent>')} for an absolute identifier.

Hope, that helps ...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top