myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "St├ęphane Poirier" <stephane.poirie...@gmail.com>
Subject [Trinidad] Data-display synchronisaion problem
Date Thu, 07 Jun 2007 16:22:05 GMT
Hi,

I have a problem synchronizing my data  with the visual result. I want to
implement 2 dependent comboBoxes (tr:selectOneChoice) using partialTriggers.
The components get their value from respective variables of a backingBean.
The problem is that when changing the master combo (which updates the child
combo when is Setter is called), the child combo refreshes but tries to
select the item it was supposed to select the time before. I noticed that
the master combo's Setter is called after the child combo's 1st Getter (so
this 1st getter has unsynchronized data).

Anyone knows what's going on and how to solve this? This sounds like a
PhaseListener issue or a bad use of the technology. Thanks in advance!
Here's some code:

JSP Code:
                        <tr:selectOneChoice value="#{
Bean.masterSelectedValue}" autoSubmit="true" id="master">
                            <f:selectItems value="#{Bean.masterList}" />
                        </tr:selectOneChoice>

                        <tr:selectOneChoice value="#{Bean.childSelectedValue}"
partialTriggers="master">
                            <f:selectItems value="#{Bean.childList}" />
                        </tr:selectOneChoice>

Bean Code :

    private ArrayList<SelectItem> masterList;
    private Object masterSelectedValue;

    private ArrayList<SelectItem> childList;
    private Object childSelectedValue;

...

    public void setMasterSelectedValue(Object value) throws Exception
    {
        this.masterSelectedValue = value;
        updateComboBoxes(); //Code that updates the child combobox value and
selected item
    }

Faces-config listener

    <lifecycle>
        <phase-listener>

org.apache.myfaces.trinidadinternal.context.TrinidadPhaseListener
        </phase-listener>
    </lifecycle>

Mime
View raw message