Hi,

I'm trying to get a ValueListBox working with RequestFactory, but
unfortunately I'm stuck.

I am able to fill the ValueListBox with the appropriate values and to
successfully retrieve the selected value in the ValueListBox, but I
can't figure out how to make the correct choice of the ValueListBox
selected.

In my application I have two proxies: PlayerProxy and a TeamProxy. A
Player always belong to one Team. Because there are only a few Teams,
I want to be able to select a team from a ValueListBox while editing a
Player.

The relevant code parts:
- PlayerEdit.ui.xml
....
  <g:ValueListBox ui:field="teamSelect" />
....

- PlayerEdit.java
....
    @UiField(provided = true)
    ValueListBox<TeamProxy> teamSelect = new
ValueListBox<TeamProxy>(new ProxyRenderer<TeamProxy>(null) {
        @Override
        public String render(TeamProxy team) {
            return team == null ? "" : team.getName();
        }
    }, new EntityProxyKeyProvider<TeamProxy>());
.....

- Code to fill the ValueListBox with AcceptableValues:
....
        teamRequest.get().findAll().fire(new Receiver<List<TeamProxy>>() {
            @Override
            public void onSuccess(List<TeamProxy> teams) {
                teamSelect.setAcceptableValues(teams);
            }
        });
....

- Code to set the selected value of the ValueListBox:
....
    view.getTeamSelect().setValue(currentPlayer.getTeam());
....

As mentioned before, the ValueListBox gets populated with the names of
the teams, but when a Player already has a Team assigned, the
PlayerDetail view never shows the correct team selected. I'm also not
sure what the "paths" argument of the ProxyRenderer does. What is this
argument for?

Can anybody help me out?

Thanks in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to