Wicket 模态窗口无法正确显示
我正在尝试为我的应用程序创建一个模式窗口,但不幸的是我无法这样做。
我有一个扩展 WebPage
的页面,并且添加了一个扩展 Panel
的面板。页面和面板分开书写;即在 panel.java
和 page.java
中。现在,我在 this Wicket 的帮助下向面板添加了一个模式窗口示例示例 (源)。但是,当页面呈现时,通过检查该页面的元素,我发现 div
的 wicket:id
为“modal1”,具有属性 script="显示:无”
。我不知道该怎么办。任何信息都会对我非常有帮助。
还有一件事:
return new ModalContent1Page(ModalWindowPage.this.getPageReference(), modal1);
和
return new ModalContent1Page(ModalWindowPage.this, modal1);
是相同的吗?
编辑:
问题解决了。事实上,当我问这个问题时,我当时并没有代码。我正在遵循 RoseIndia 的教程,但我没有成功,因为我我使用的是 wicket 1.3.1,PageReference 类在那里不可用。所以我解决它:
final ModalWindow modalWindow;
add(modalWindow = new ModalWindow("modalVideo"));
modalWindow.setCookieName("modal-video");
modalWindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
modalWindow.setResizable(false);
modalWindow.setInitialHeight(215);
modalWindow.setInitialWidth(215);
modalWindow.setHeightUnit("px");
modalWindow.setPageCreator(new ModalWindow.PageCreator() {
public Page createPage() {
return new PlayVideo(ItemViewPanel.this.getPage(), modalWindow, itemId);
}
});
AjaxLink showModalLink;
add(showModalLink = new AjaxLink("showModal") {
@Override
public void onClick(AjaxRequestTarget target) {
modalWindow.show(target);
}
});
谢谢。
I am trying to create a modal window for my application, but unfortunately I am unable to do so.
I have a page that extends WebPage
and I have added a panel that extends Panel
to it. The page and panel are written separately; that is, in panel.java
and page.java
. Now, I have added a modal window to the panel with the help of this Wicket Examples example (source). But when the page renders, I am seeing — by inspecting element of that page — that the div
with wicket:id
of "modal1" has attribute script="display: none"
. I don't know what to do. Any information will be very helpful to me.
One more thing: are
return new ModalContent1Page(ModalWindowPage.this.getPageReference(), modal1);
and
return new ModalContent1Page(ModalWindowPage.this, modal1);
the same?
Edit:
The problem is solved. Actually when I asked the question I did not have the code then. I was following the tutorial of RoseIndia, but I was unsuccessful and as I am using wicket 1.3.1 the PageReference class is not available there. So I solve it as:
final ModalWindow modalWindow;
add(modalWindow = new ModalWindow("modalVideo"));
modalWindow.setCookieName("modal-video");
modalWindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
modalWindow.setResizable(false);
modalWindow.setInitialHeight(215);
modalWindow.setInitialWidth(215);
modalWindow.setHeightUnit("px");
modalWindow.setPageCreator(new ModalWindow.PageCreator() {
public Page createPage() {
return new PlayVideo(ItemViewPanel.this.getPage(), modalWindow, itemId);
}
});
AjaxLink showModalLink;
add(showModalLink = new AjaxLink("showModal") {
@Override
public void onClick(AjaxRequestTarget target) {
modalWindow.show(target);
}
});
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
回答你的第二个问题:不,这两行代码不一样。
ModalWindowPage.this
是页面本身,因此其类型为ModalWindowPage
。另一方面,getPageReference()
返回一个PageReference
,它不在同一层次结构中。To answer your second question: no, those two lines of code are not the same.
ModalWindowPage.this
is the page itself, so its type isModalWindowPage
.getPageReference()
, on the other hand, returns aPageReference
, which is not in the same hierarchy.