Martijn,

I tried your solustion(s), but the CSS class of the topicLabel still
not updated.

    public TestPage() {
        final WebMarkupContainer container = new
WebMarkupContainer("container");
        container.setOutputMarkupId(true);

        container.add(new ListView<Category>("categories", buildCategories()) {
            @Override
            protected void populateItem(ListItem<Category> item) {
                Category category = item.getModelObject();
                item.add(new Label("category", category.getName() + ": "));
                ListView<Topic> topicListView;
                item.add(topicListView = new ListView<Topic>("topics",
category.getTopics()) {
                    @Override
                    protected void populateItem(final ListItem<Topic> item) {
                        Topic topic            = item.getModelObject();
                        final Label topicLabel = new Label("topic",
topic.getName());
                        item.add(new AjaxLink<String>("topicLink") {
                            @Override
                            public void onClick(AjaxRequestTarget target) {
                                topicLabel.add(new
AttributeModifier("class", true, new AbstractReadOnlyModel<String>() {
                                    @Override
                                    public String getObject() {
                                        return "highlight";
                                    }
                                }));
                                target.addComponent(container);
                            }
                        }.add(topicLabel));
                    }
                });
                topicListView.setReuseItems(true);
            }
        });
        add(container);
    }


    <div wicket:id="container">
        <ul class="menu">
            <li class="r" wicket:id="categories">
                <span class="category" wicket:id="category">Category A: </span>
                <ul>
                    <li wicket:id="topics">
                        <a wicket:id="topicLink"><span
wicket:id="topic">Link</span></a>
                    </li>
                </ul>
            </li>
        </ul>
    </div>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to