wicket AjaxLink onclick not responding

2019-08-15 01:53发布

I'm building a website with wicket. I have a modal window that opens from an ajaxlink from the main page. The problem is that when I added a CSS to my HTML code in order to make it more visible attractive, it stopped working. So now, when I click in the AjaxLink that opens the modal window, nothing happens and I can't figure out why. Any Ideas??

This is the code of the AjaxLink:

AjaxLink privacyLink = new AjaxLink<Void>("privacylink") {
    @Override
    public void onClick(AjaxRequestTarget target) {
        // TODO Auto-generated method stub
        modal2.show(target);
    }
}; 

One more comment. This AjaxLink is introduced as a part of a ListView, so actually there are multiple AjaxLinks.

2条回答
男人必须洒脱
2楼-- · 2019-08-15 02:06

In order for the AjaxLink to refresh you will need to call something along the lines of:

modal2.setVisible(true);
target.addComponent(modal2Container);

Where modal2 is the component that you want to control the visibility of, and modal2Container is a WebMarkupContainer with .setOutputMarkupId(true) that modal2 is added to when the page/panel is constructed.

I have found the examples at http://www.wicket-library.com/wicket-examples-1.4.x/ajax/ to be particularly useful (I'm using 1.4, but there are other examples for whichever version of wicket you are running you can get to from http://wicketstuff.org/).

查看更多
别忘想泡老子
3楼-- · 2019-08-15 02:11

I finally found the solution!!, It was a problem of the version of jQuery that I was using (1.4.2) so I just changed it to 1.5.2 and it worked!

查看更多
登录 后发表回答