wicket AjaxLink onclick not responding

荒凉一梦 提交于 2019-12-11 11:26:03

问题


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.


回答1:


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!




回答2:


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/).



来源:https://stackoverflow.com/questions/13157818/wicket-ajaxlink-onclick-not-responding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!