javascript 如何在Liferay中制作弹出窗口?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7725343/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make popup window in Liferay?
提问by andriy
How to make popup window in Liferay? This my code. It's like in Liferay Wiki.
如何在Liferay中制作弹出窗口?这是我的代码。就像在 Liferay Wiki 中一样。
var popup = new Liferay.Popup( {
header: 'our title',
position:[150,150],
modal:true, width:500,
height:300,
xy: ['center', 100],
url: '/my_file.jsp',
urlData: { winowState : 'LiferayWindowState.EXCLUSIVE'}
} );
What is missing?
缺什么?
PS: I'm trying to put it working in Liferay 6.0
PS:我试图让它在 Liferay 6.0 中工作
回答by rp.
On top of sandeepnair85's answer, to AJAX in content form your URI, you'll have to add the following code:
除了sandeepnair85的回答之外,对于URI形式的内容中的AJAX,您必须添加以下代码:
<aui:script use="aui-dialog">
function showPopup(){
var dialog = new A.Dialog({
title: 'DISPLAY CONTENT',
centered: true,
modal: true,
width: 200,
height: 200
}).plug(A.Plugin.IO, {
uri: 'http://myurl.com'
}).render();
}
</aui:script>
More details on how the A.Plugin.IO plugin works can be found here: http://alloy.liferay.com/deploy/api/A.Plugin.IO.html
可以在此处找到有关 A.Plugin.IO 插件如何工作的更多详细信息:http://alloy.liferay.com/deploy/api/A.Plugin.IO.html
回答by Sandeep Nair
Hi can you try this code. Its a simple example on how to create popup in liferay usin AUI
你好,你可以试试这个代码。这是一个关于如何使用 AUI 在 liferay 中创建弹出窗口的简单示例
<aui:script use="aui-dialog">
function showPopup(){
var dialog = new A.Dialog({
title: 'DISPLAY CONTENT',
centered: true,
modal: true,
width: 200,
height: 200,
bodyContent: "My First popup"
}).render();
}
</aui:script>