psicopoo
psicopoo

Reputation: 1676

How to insert wicket components into 'sub-rows' of a Wicket DataTable

I wish to add subrows to my DataTable (as done in How to insert 'sub-rows' into a Wicket DataTable), but I'd like to go a step further and add my own custom wicket components within the added html for the sub-row. Since the extra HTML in that question was added in the onRender it's always too late to add components. Is there another way to add the markup and Wicket components as a sub-row of a DataTable?

Upvotes: 3

Views: 1574

Answers (1)

schmimd04
schmimd04

Reputation: 1454

Use an AbstractColumn instead of a PropertyColumn. For example:

columns.put(new AbstractColumn<TestResult>(new Model<String>("test column")) {
    @Override
    public void populateItem(Item<ICellPopulator<TestResult>> cellItem, String componentId, IModel<TestResult> rowModel) {
        cellItem.add(new MyComponent(componentId));
    }
});

Upvotes: 4

Related Questions