Wicket AjaxSubmitLink onSubmit 在应用改变页面 DOM 的 appendJavascript 后不会被调用。示例代码是:
add(new ListView("list", someArrayList){
@Override
protected void populateItem(final ListItem item) {
add(new AjaxSubmitLink("link") {
@Override
public void onClick(AjaxRequestTarget target) {
target.appendJavascript("swap('"+this.getMarkupId()+"')");
});
})
JavaScript 看起来像:
function swap(markupId){
var one = $('.dashed').first().parent();
var two = $('#'+markupId).parent();
var tone = one.clone();
var ttwo = two.clone();
one.replaceWith(ttwo);
two.replaceWith(tone);
}
有什么建议么?