Hi All, how are you?

   I'm new in this list, actually I'm new to wicket and I'm trying to learn
it. So far I hadn't found any issues and it worked great until I came across
this anoying problem, I have as part of my html:
I wanted to add to a page a button with a text, on click the button hits the
sever, performs some action and it should remove the button from the page
(make it not visible)

I added:
<a class="button" wicket:id="ajaxbutton"><label
wicket:id="button-text"></label></a>

and then In the java Page I have

(this code is inside a populateItem method from a ListView)
.
.
.
                            protected void populateItem(final ListItem<Poll>
item) {
                                      final AjaxLink<Test> button = new
AjaxLink<Test>("ajaxbutton", item.getModel()) {

public void onClick(AjaxRequestTarget target) {
                                                        //Do whatever I have
to do
System.out.println("works?");
this.setEnabled(false); //Also tried removing the label component,
setVisible(false)
}

};
 Label label = new Label("button-text", "AText");
label.setOutputMarkupId(true);
button.add(label);
button.setOutputMarkupId(true);//these are desparates attemps to solve it
item.setOutputMarkupId(true);
button.setEnabled(!item.getModelObject().shouldBeDisabled()); //this works,
those that should be disabled do not show a button.
item.add(button);
                          }
.
.


Any idea of what I'm doing wrong?

Thanks!

Reply via email to