Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6203519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:55:52+00:00 2026-05-24T04:55:52+00:00

I created a palette which contains values, and i created a DropDownChoice ddcdomaines with

  • 0

I created a palette which contains values, and i created a DropDownChoice ddcdomaines with an AjaxFormComponentUpdatingBehavior to update choice list, but i dont know how to do it, can you help me?

Here my code:

List<PartnerDomainDTO> domaines = partenaireHelper.allDomains();
    ChoiceRenderer choiceRenderer = new ChoiceRenderer("label", "sid");

    final Palette palette =
        new Palette("partenaires", new PropertyModel(offre, "partenaires"), new Model(
            (Serializable) partenairesPossibles), renderer, 10, false) {
          private static final long serialVersionUID = 1178320215146881229L;

          boolean first = true;

          @Override
          public Iterator getSelectedChoices() {
            if (first) {
              first = false;
              return partenairesExistants.iterator();
            }
            return super.getSelectedChoices();
          }
        };
    palette.setOutputMarkupId(true);
    palette.setOutputMarkupPlaceholderTag(true);

    DropDownChoice ddcdomaines = new DropDownChoice("domaines", new Model(domaines.get(0)), domaines, choiceRenderer);

    ddcdomaines.add(new AjaxFormComponentUpdatingBehavior("onchange") {
      @Override
      protected void onUpdate(AjaxRequestTarget target) {
        remove(palette);
        Palette palette1 =
            new Palette(
                "partenaires",
                new PropertyModel(offre, "partenaires"),
                new Model(new ArrayList<Partenaire>()),
                renderer,
                10,
                false);
        palette1.setOutputMarkupId(true);
        palette1.setOutputMarkupPlaceholderTag(true);
        add(palette1);
        target.addComponent(palette);
        target.addComponent(palette1);
      }
    });
    add(palette);
    add(ddcdomaines);
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:55:53+00:00Added an answer on May 24, 2026 at 4:55 am

    Here is an excellent example of DropDownChoice with AjaxFormComponentUpdatingBehavior:

    http://wicketstuff.org/wicket/ajax/choice

    Click on the Source Code link to see the source. If you need more information, than you need to provide more detail in your question.

    Update: According to the JavaDoc, there is a specific way to update Palettes using Ajax:

    http://wicket.apache.org/apidocs/1.4/org/apache/wicket/extensions/markup/html/form/palette/Palette.html

    Make sure you follow those instructions before doing anything else.

    In your code, you are attempting to remove one Palette and put in another Palette. While this might work in the long run, it is not very Wicket-y. Sadly, Palette does not have a public method to change the choices. However, if you keep a reference to your choicesModel, then you can modify that list and the Palette should see the change on re-render. Something like this:

    final Model<List<String>> choicesModel = new Model<List<String>>(partenairesPossibles)
    
    final Palette palette = new Palette("partenaires", new PropertyModel(offre, "partenaires"), choicesModel, renderer, 10, false) {...};
    

    And then in your Ajax onUpdate

    choicesModel.setObject(/* Insert your other list */);
    target.addComponent(palette);
    

    Be careful with keeping track of the selected choices and the possible choices. I’m not sure what will happen if these don’t match up. Hope that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a navigation bar programmatically, and as far as I know, you can
Is there a way to create my own charting palette in which I can
I created a plugin for Internet Explorer (ActiveX object) and installed it successfully, but
I created a program using dev-cpp and wxwidgets which solves a puzzle. The user
I've a Java source file which I've created in eclipse. After this I installed
In Delphi 7, an image editor program is included, which can read and write
Some people are saying that I must update the controls in Win3.1 palette (especially
I created a custom color palette for my charts using a technique described on
I want to add colours to the edges of the graph which I created
Update Mr Wizard's answer gives pixel-perfect results, but it is Windows-only and destroys the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.