Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Liferay 6 如何关闭Liferay.util.openWindow弹出窗口?_Liferay 6 - Fatal编程技术网

Liferay 6 如何关闭Liferay.util.openWindow弹出窗口?

Liferay 6 如何关闭Liferay.util.openWindow弹出窗口?,liferay-6,Liferay 6,我使用以下代码在弹出窗口上加载WebContent编辑portlet: <liferay-ui:icon image="edit" message="Edit" url="<%= editUrl %>" /> 保存或发布内容时,将在弹出窗口中加载portlet。我希望关闭弹出窗口,并刷新带有editURL链接的portlet。只有在编辑成功且弹出窗口刷新时,才能从弹出窗口调用以下javascript函数: Liferay.provide(

我使用以下代码在弹出窗口上加载WebContent编辑portlet:

<liferay-ui:icon 
    image="edit" 
    message="Edit" 
    url="<%= editUrl %>"
/>

保存或发布内容时,将在弹出窗口中加载portlet。我希望关闭弹出窗口,并刷新带有editURL链接的portlet。

只有在编辑成功且弹出窗口刷新时,才能从弹出窗口调用以下javascript函数:

Liferay.provide(
        window,
        'closePopUpAndRefreshPortlet',
        function(customPopUpId) {

            var A = AUI();

            A.DialogManager.closeByChild('#' + customPopUpId);

            var curPortletBoundaryId = '#p_p_id<portlet:namespace />';

            Liferay.Portlet.refresh(curPortletBoundaryId);
        },
        ['aui-dialog','aui-dialog-iframe']
    );
Liferay.provide(
窗口,
“closePopUpAndRefreshPortlet”,
函数(customPopUpId){
var A=AUI();
A.DialogManager.closeByChild(“#”+customPopUpId);
var curPortletBoundaryId='#p#p#id';
refresh(curPortletBoundaryId);
},
['aui-dialog','aui-dialog-iframe']
);
解释

通过向对话框管理器的
closeByChild
函数提供弹出窗口的
id:“+liferayPortletResponse.getNamespace()+”
,可以关闭弹出窗口

Liferay已经定义了一个通过ajax刷新portlet的实用方法,因此您只需将portlet的
传递给
刷新
函数即可

因此,当成功更新后刷新弹出窗口时,如果调用函数
closePopUpAndRefreshPortlet(“customPopUpID”)
,它首先关闭自身,然后刷新包含portlet的父级


希望这有帮助。

这一页可能会有帮助-

如果您这样定义模式窗口(比如在view.jsp中):


A.one('openDialog')。在('click',函数(事件){
Liferay.Util.openWindow({
对话框:{
对,,
身高:300,
莫代尔:是的,
宽度:400
},
id:'对话框',
标题:“”,
uri:“”
});
});
并在对话框页面(dialog.jsp)内创建按钮触发器(或在您的示例中为onsubmit事件侦听器):


A.one('closeDialog')。在('click',函数(事件){
//让我们假设“数据”包含处理结果
变量数据=。。。
//使用processgin结果和对话框id调用函数
Liferay.Util.getOpener().closePopup(数据“对话框”);
});
您将通过getOpener()函数获得打开对话框的窗口。在创建对话框的页面(view.jsp)中,必须提供如下关闭弹出功能:

<aui:script>
    Liferay.provide(
        window,
        '<portlet:namespace/>closePopup',
        function(data, dialogId) {
            var A = AUI();

            // Here you can use "data" parameter

            // Closing the dialog
            var dialog = Liferay.Util.Window.getById(dialogId);
            dialog.destroy();
        },
        ['liferay-util-window']
    );
</aui:script>

Liferay.com提供(
窗口,
“关闭弹出窗口”,
函数(数据、对话框ID){
var A=AUI();
//这里可以使用“数据”参数
//关闭对话框
var dialog=Liferay.Util.Window.getById(dialogId);
dialog.destroy();
},
['liferay-util-window']
);

Hi,我已经编辑了答案-这只是我的懒散(复制这个问题之前的答案)。对不起。
<aui:button name="openDialog" type="button" value="open-dialog" />

    <liferay-portlet:renderURL var="dialogURL" windowState="<%=LiferayWindowState.POP_UP.toString() %>">
        <liferay-portlet:param name="mvcPath" value="/dialog.jsp" />
    </liferay-portlet:renderURL>
    <aui:script use="liferay-util-window">
    A.one('#<portlet:namespace/>openDialog').on('click', function(event) {
        Liferay.Util.openWindow({
            dialog: {
                centered: true,
                height: 300,
                modal: true,
                width: 400
            },
            id: '<portlet:namespace/>dialog',
            title: '<liferay-ui:message key="i-am-the-dialog" />',
            uri: '<%=dialogURL %>'
        });
    });
</aui:script>
<aui:button name="closeDialog" type="button" value="close" />

<aui:script use="aui-base">
    A.one('#<portlet:namespace/>closeDialog').on('click', function(event) {
        // Let's suppose that "data" contains the processing results
        var data = ...
        // Invoke a function with processgin results and dialog id
        Liferay.Util.getOpener().<portlet:namespace/>closePopup(data, '<portlet:namespace/>dialog');
    });
</aui:script>
<aui:script>
    Liferay.provide(
        window,
        '<portlet:namespace/>closePopup',
        function(data, dialogId) {
            var A = AUI();

            // Here you can use "data" parameter

            // Closing the dialog
            var dialog = Liferay.Util.Window.getById(dialogId);
            dialog.destroy();
        },
        ['liferay-util-window']
    );
</aui:script>