Thanks for quick reply, Nino.

No, I'm not using ajax so far.

Let me describe a bit more: there's a registration page, which has a
RegisterForm. Also, the page has an OptionsPanel unrelated to the
RegisterForm with a language selector DDC. That DDC is bound to Session's
"language" property via PropertyModel. What I want is to reorder items in
RegisterForm's DDCs.

I've actually implemented it this way (list of countries is one of the lists
that must be reordered):

OptionsPanel:

add(new DDC(...) {
  onSelectionChanged() {
    ...
    ((BasePage) getPage()).notifyLanguageSwitch();
  }
});


RegisterPage:

RegisterPage extends BasePage {

  init() {
  ...
    processLocaleSpecificComponents();
  ...
  }

  notifyLanguageSwitch() {
    processLocaleSpecificComponents();
  }

  processLocaleSpecificComponents() {

    Component countriesChoice = get("countryChoice");

    DDC newCountriesChoice = new DDC("countryChoice",
getCountriesList(getLanguageId()), new ChoiceRenderer(...));

    if (countriesChoice != null) {
      countriesChoice.replaceWith(newCountriesChoice);
    } else {
      add(countriesChoice);
    }
  }
}

But you're saying, I don't have to reconstruct components. How can I control
order of items in the DDC then? Even though data is provided dynamically,
like this:

add(new DropDownChoice("countryChoice", getCountriesList(getLanguageId()),
new ChoiceRenderer("name", "id"));

the getCountriesList() method isn't called when page is reloaded to switch
language.


On Wed, Apr 2, 2008 at 11:14 AM, Nino Saturnino Martinez Vazquez Wael <
[EMAIL PROTECTED]> wrote:

you could use call modelchanged on the forms model. Or make the components
> take an ajaxrequesttarget, depending if youre using ajax?
>
> You should'nt have to reconstruct them. But that depends if youre using
> models or not etc..
>
> The problem is, when user changes language via selector, all dropdown
> > lists
> > must be reordered to keep being alphabetically sorted.
> >
> > I guess I have to re-construct my DropDownChoice components for this,
> > but
> > I'm not sure how to notify the page of the language change event. Can I
> > somehow make the form on the registration page listen to an unrelated
> > component's onChange event?
> >
>
-- 
sp

Reply via email to