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 698587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:17:30+00:00 2026-05-14T03:17:30+00:00

I try to realize a link (in fact many links) that update a table

  • 0

I try to realize a link (in fact many links) that update a table in an website using an AjaxLink of Wicket. But I fail, the table is never updated (I have “setOutputMarkupId(true)” and call “setDefaultModelObject” and “addComponent”, but there must be something other thats wrong).

How can I realize a panel with a number of links and a table that displays dynamic data, dependent on the link clicked? Can someone give an example (Maybe two links, when the first one is clicked the table displays two random numbers from 1-10, when the second is clicked the table displays random numbers from 1-100)? Without reloading the entire page, but only the html for the table?

  • 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-14T03:17:30+00:00Added an answer on May 14, 2026 at 3:17 am

    I don’t think you’ve defined what you are doing very clearly.

    Are these 2 tables different implementations? If so, then your code is correct – you have to replace the old component with the new one, then add the new one to the ajax response.

    Realistically though, I’d imagine that you have 1 table component implementation.

    What you therefore need to do, is something like this:

    public class RandomNumberListModel extends LoadableDetachableModel {
        private int upperBound;
    
        public RandomNumberListModel(int upperBound) {...}
    
        public void setUpperBound(int upperBound) {...}
    
        protected Object load() {
            // generate random number list using upper bound
            // return list
        }        
    }
    
    ...
    
    final MyTableComponent table = new MyTableComponent(new RandomNumberListModel(30));
    add(table);    
    AjaxLink link = new AjaxLink("myButton") {
        public void onClick(final AjaxRequestTarget target) {
            table.getModel().setUpperBound(100);
            target.addComponent(table);
        }
    };
    add(link);
    

    (Edit) I’ve added a dynamic, reusable model to illustrate how the model would work. There are different ways of implementing this, depending on what you want to be reusable. The key point is that the model generates the list dynamically, i.e. per request, and the upperBound of the number range can be manipulated in the onClick callback.

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

Sidebar

Related Questions

I realize that there are many questions similar to this one, but having looked
I'd like to link MyModel to AnotherModel using a many to many relationship without
I realize that far is compiler specific, but my expectation is that the placement
I try to realize that, when the user click on a button (custom one),
I realize the knee-jerk response to this question is that you dont., but hear
I realize that this is probably a very basic question, but I have spent
I realize that title is a bit vague, so let me try and clear
I try to realize a little game project to dive deeper into OO programming
I try to realize simple code on perl which should just get/send messages from/to
I try to replace a jquery chaned function with a var but it doesnt

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.