本文介绍了如何打开JSF Portlet的编辑模式的弹出窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

打开Liferay Portlet的配置模式时,它将在弹出对话框中打开:

When opening the configuration mode of a Liferay portlet it opens in a pop up dialog:

如何获取我的JSF Portlet来打开类似的弹出窗口,但要更改为JSF Portlet的编辑模式?

How can I get my JSF portlet to open a similar pop up but for edit mode of my JSF portlet?

我正在使用Liferay 6.2.

I am using Liferay 6.2.

推荐答案

在Liferay 6.2+中:

在大多数情况下,您可以打开JSF Portlet的编辑模式对JSF和JSP Portlet的使用相同方法:通过客户端JS Liferay.Util.Window.getWindow()方法.要创建对话框,您将需要在编辑方式下获取portlet的呈现URL,并通过 portlet:renderURL :

In Liferay 6.2+:

For the most part, you can open edit mode of a JSF portlet the same way for both JSF and JSP portlets: via the client-side JS Liferay.Util.Window.getWindow() method. To create the dialog, you will need to get a render URL for the portlet in edit mode and pop up state via portlet:renderURL:

<portlet:renderURL var="popUpEditModeURL" escapeXml="false"
    portletMode="edit" windowState="pop_up" />

然后在Liferay.Util.Window.getWindow()方法中使用URL:

Then use the URL in the Liferay.Util.Window.getWindow() method:

<h:outputScript>
    AUI().use('liferay-util-window', function(A) {
        var popUp = Liferay.Util.Window.getWindow({
            dialog: {
                centered: true,
                constrain2view: true,
                resizable: false
            }
        }).plug(A.Plugin.DialogIframe, {
            autoLoad: true,
            iframeCssClass: 'dialog-iframe',
            uri:'#{popUpEditModeURL}'
        }).render();

        // call `popUp.show();` to show the dialog.
    });
</h:outputScript>

然后,每当要在编辑方式下显示portlet时,都调用popUp.show().

Then call popUp.show() whenever you want to show the portlet in edit mode.

或者,您可以使用 Liferay Faces Alloy的对话框(或任何其他组件套件的对话框),其中带有iframe,以在对话框中显示编辑模式:

Alternatively, you could use a Liferay Faces Alloy's dialog (or any other component suite's dialog) with an iframe inside it to show edit mode in a dialog:

<alloy:dialog height="95%" width="95%" clientKey="dialog">
    <iframe height="100%" width="100%" src="${popUpEditModeURL}" />
</alloy:dialog>

但是,此方法可能无法产生与使用Liferay.Util.Window.getWindow()完全相同的效果.

However, this method may not produce exactly the same effect as using Liferay.Util.Window.getWindow().

全面披露::我是Liferay Faces Alloy的开发商之一.

Full disclosure: I am one of the developers of Liferay Faces Alloy.

这篇关于如何打开JSF Portlet的编辑模式的弹出窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 22:34