如何打开和关闭 wiQuery 对话框?
我正在尝试 wiQuery 看看它是否适合我的需求,但我遇到了非常基本的东西的问题。考虑以下内容,我尝试使用其 open()
和 close()
方法来控制对话框何时打开和关闭:
HTML:
<input type="submit" wicket:id="open" value="Open dialog"/>
<div wicket:id="dialog">
<input type="submit" wicket:id="close" value="Close"/>
</div>
Java:
final Dialog dialog = new Dialog("dialog");
add(new Link("open") {
@Override
public void onClick() {
dialog.open();
}
});
dialog.add(new Link("close") {
@Override
public void onClick() {
dialog.close();
}
});
add(dialog);
事情是,上面的不起作用。
我真正打开对话框的唯一方法是与我的代码最接近的是通过使用 true 或 false 调用 setAutoOpen() ,但奇怪的是这是唯一的方法。 (该方法的 Javadoc 说“设置此窗口在页面加载后是否自动打开。”所以它显然应该保留用于不同的目的。)
打开和关闭 wiQuery 的正确方法是什么在您的代码中动态对话框?
I'm trying out wiQuery to see if it suits my needs, but I've run into problems with very basic stuff. Consider the following, where I try to control when a Dialog opens and closes, using its open()
and close()
methods:
HTML:
<input type="submit" wicket:id="open" value="Open dialog"/>
<div wicket:id="dialog">
<input type="submit" wicket:id="close" value="Close"/>
</div>
Java:
final Dialog dialog = new Dialog("dialog");
add(new Link("open") {
@Override
public void onClick() {
dialog.open();
}
});
dialog.add(new Link("close") {
@Override
public void onClick() {
dialog.close();
}
});
add(dialog);
Thing is, the above doesn't work.
The only way I've got the dialog to actually open & close from my code is by calling setAutoOpen() with either true or false, but it seems strange is this is the only way. (That method's Javadoc says "Sets if this window opens autmatically after the page is loaded." so it clearly should be reserved for a different purpose.)
What's the right way of opening and closing wiQuery Dialogs dynamically in your code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我过去两周一直在使用,也遇到了类似的问题。尝试这样使用 AjaxLink:
I have been using the last 2 weeks and I have a similar problem. Try using an AjaxLink this way: