You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Ido Tamir <ta...@imp.univie.ac.at> on 2008/05/23 18:14:46 UTC

[trinidad] selectOneChoice valueChangeListener and valueChangeNotifier

Hi,
in a tr:table I update the values of my bean directly using
tr:selectOneChoice and
save them to the db.
In the betDAO I am able to receive the updated value, and thanks to SEAM
magic
the old bet object, but I would actually like to get the actual bet object 
with the updated values (and the old one actually too). So I need also some
function
that gets called in (after?) update model values. 

How do I do this?
Do I have to give selectOneChoice an id and then check for the id in the
valueChangeListener,
then update the appropriate value etc...
Or is there something like valueChangeNotifier
(http://issues.apache.org/jira/browse/MYFACES-864)
implemented?
Or is there something else to do?

thank you very much,
ido


@Stateful
@Name("betDAO")
public class BetDAO implements IBetDAO {
    @PersistenceContext
    EntityManager em;

    @In
    Bet bet;

    public void valueChange(ValueChangeEvent valueChangeEvent) {
          log.error("event");
          log.error(valueChangeEvent.getNewValue() + " " +
valueChangeEvent.getOldValue());
          log.error(valueChangeEvent.getComponent());
          log.error(valueChangeEvent.getSource());
          log.error("bet:" + bet);  //here I am now able to detect the old
bet.
    }

}

<tr:form>
     <tr:table value="#{myBets.dataModel}" var="bet"
rows="#{myBets.maxResults}">
        <tr:column>
	<f:facet name="header">Bet</f:facet>
           	<tr:selectOneChoice value="#{bet.firstGoals}" simple="true"
autoSubmit="true" valueChangeListener="#{betDAO.valueChange}">
		<tr:selectItem label="0" value="0"/>
		<tr:selectItem label="1" value="1"/>
		//etc..
                </tr:selectOneChoice>

//etc..

-- 
View this message in context: http://www.nabble.com/-trinidad--selectOneChoice-valueChangeListener-and-valueChangeNotifier-tp17428153p17428153.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [trinidad] selectOneChoice valueChangeListener and valueChangeNotifier

Posted by Ido Tamir <ta...@imp.univie.ac.at>.
I could solve this myself by adding an onsubmit to the enclosing form
and some Out and In SEAM magic.

ido
-- 
View this message in context: http://www.nabble.com/-trinidad--selectOneChoice-valueChangeListener-and-valueChangeNotifier-tp17428153p17447349.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.