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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:25:57+00:00 2026-06-09T16:25:57+00:00

I have printed a table using the DefaultDataTable object in Apache Wicket. Now I

  • 0

I have printed a table using the DefaultDataTable object in Apache Wicket.
Now I want to add a link to each table cell.

I found this link which explained some of it, but I have a problem with the first method.

    columns[0] = new TextFilteredPropertyColumn(new Model("Id"), "id", "id") {
        // add the LinkPanel to the cell item
        public void populateItem(Item cellItem, String componentId, IModel model) {
            final Transaction transaction = (Transaction) model.getObject(cellItem);
            cellItem.add(new TransactionList.LinkPanel(componentId, transaction));
        }
    };


private class LinkPanel extends Panel {
    public LinkPanel(String id, Transaction transaction) {
        super(id);
        final String name = transaction.getId();
        PageParameters param = new PageParameters("id=" + name);
        BookmarkablePageLink link = new BookmarkablePageLink("link", TransactionDetail.class, param);
        link.add(new Label("label", name));
        add(link);
    }

What is the transaction and what does the transaction do? What is the LinkPanel class? If there is an easier way, I’ll love to know it!

  • 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-06-09T16:25:59+00:00Added an answer on June 9, 2026 at 4:25 pm

    The “Transaction” is the object in the model of the cell (it is probably coming from the example as it is not coming from wicket). The “LinkPanel” class is an inner class that is also not from wicket. The purpose of this class is to make a panel that will contain a Link. You could add the link directly in the cell without having a panel like LinkPanel

    columns[0] = new TextFilteredPropertyColumn(new Model("Id"), "id", "id") {
     // add the LinkPanel to the cell item
     public void populateItem(Item cellItem, String componentId, IModel model) {
        cellItem.add(new Link<String>(componentId) {
    
           @Override
           public void onClick() {
             setResponsePage(aPage.class);
             //or do what you want when the link is clicked
           }
    
           @Override
           public IMarkupFragment getMarkup() {
               // display the content you like - access the properties of your object
               return Markup.of("<div wicket:id='cell'>" + model.getObject() + "</div>");
           }
        });
    
        // Populate your item here
     }
    };
    

    But I would recommend to keep the inner panel (like LinkPanel) approach as I think it is a better practice then adding the link directly. By having your inner panel, you will be able to add label or images to the link very easily, something that would be much more difficult if you add the link directly.

    Here is what I usualy do when I need to add links in a table (note that CallDetailRecord is not from wicket, it is just the object I used in this case) :

    ...
    
    columns.add(new UserActionsColumn(new Model<String>(" ")));
    
    ...
    
    private class UserActionsColumn extends AbstractColumn<CallDetailRecord> {
    private static final long serialVersionUID = 1L;
    
    public UserActionsColumn(IModel<String> displayModel) {
      super(displayModel);
    }
    
    @Override
    public void populateItem(Item<ICellPopulator<CallDetailRecord>> cellItem,
                             String componentId,
                             final IModel<CallDetailRecord> rowModel)
    {
      cellItem.add(new UserActionPanel(componentId, rowModel));
    }
    }
    
    private class UserActionPanel extends Panel {
    private static final long serialVersionUID = 1L;
    
    public UserActionPanel(String id, final IModel<CallDetailRecord> model) {
      super(id);
      add(new AjaxLink<CallDetailRecord>("viewLink", model) {
        private static final long serialVersionUID = 1L;
    
        @Override
        public void onClick(AjaxRequestTarget target) {
    
          //actions to do when link is clicked
        }
      });
    }
    }
    

    Hope this help

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

Sidebar

Related Questions

I have a table of buttons that are printed using PHP. Each button has
I have an HTML table of data where each cell can have multiple lines
i have printed out the contents of an array/object (named 'document') with print_r. it
I have an application that generates around 10000 printed pages per month. Each report
I have clients who still using dot matrix for making copies of printed documents
If I have the following data that is printed seperated by tabs using print
I'd like to have my table's headers repeated for every printed page, but it
I have never printed anything using C#. I was just wondering what the standard
So I'm using PHP/MySQL and I have a tbl_profile table with the following fields:
I have this table, I dynamically load it, and after that I add 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.