Fórum

How to close pop up in liferay 6.2

thumbnail
Shahbaj Maner, modificado 10 Anos atrás.

How to close pop up in liferay 6.2

New Member Postagens: 11 Data de Entrada: 29/11/13 Postagens Recentes
I am using Liferay UI for popup window. I am getting the pop up but i can not close it. Below is my code which is written on parent page.
//-----------------------------------------------------------------------------------------------------------------------------------------------------//
AUI().ready(function(A) {
	    AUI().use('aui-dialog', 'aui-io', function(A) {
	   		 var url = '<%=testPopupURL.toString()%>';
    Liferay.Util.openWindow(
            {
                dialog: {
                    cache: false,
                    width:800,
                    modal: true
                },
               	id:'<portlet:namespace />shahbaj',              
                uri: url
            }
        );
 Liferay.provide(
        window,
        '<portlet:namespace />closePopup',
        function(popupIdToClose) {
            var A = AUI();
			alert(popupIdToClose);
			A.DialogManager.closeByChild('#' + popupIdToClose);
        },
        ['aui-base','aui-dialog','aui-dialog-iframe']
    );
        }); 
});

//-----------------------------------------------------------------------------------------------------------------------------------------------------//

Below code is popup page content


<aui:button name="YES" value="YES" onClick="javascript:yes();" />

<aui:script>
function yes(){
alert('pop');
Liferay.Util.getOpener().<portlet:namespace />closePopup('<portlet:namespace />shahbaj');
}
</aui:script>


--------------------------------------------------------

Please help me out!!
thumbnail
Charu Babbar, modificado 10 Anos atrás.

RE: How to close pop up in liferay 6.2

Regular Member Postagens: 167 Data de Entrada: 13/09/11 Postagens Recentes
Please try this snippet and let me know:


Liferay.Util.getOpener().<portlet:namespace />closePopup(popupIdToClose);



The popupIdToClose is the same id which is used when opening the pop-up as shown:
taglibEditURL = "javascript:"
+ Liferay.Util.openWindow({"
+ "dialog: {width: 960},"
+ "id: '" + renderResponse.getNamespace() + "'," // This is the "popupIdToClose"
+ "title: '" + LanguageUtil.format(request.getLocale(), "edit-x", HtmlUtil.escape(assetRenderer.getTitle(request.getLocale()))) + "',"
+ "uri:'" + HtmlUtil.escapeURL(editPortletURLString)
+ "'}"
+ ");";
thumbnail
Shahbaj Maner, modificado 10 Anos atrás.

RE: How to close pop up in liferay 6.2

New Member Postagens: 11 Data de Entrada: 29/11/13 Postagens Recentes
I have already used this.This is not working. Anyhow ID does not matter as long as it is correctly given at both side...
thumbnail
Shahbaj Maner, modificado 10 Anos atrás.

RE: How to close pop up in liferay 6.2

New Member Postagens: 11 Data de Entrada: 29/11/13 Postagens Recentes
Still trying on it but could not come up with a appropriate solution!! Guys please assist me!!
Wojciech Tutro, modificado 10 Anos atrás.

RE: How to close pop up in liferay 6.2

New Member Postagens: 22 Data de Entrada: 15/07/13 Postagens Recentes
Hi,

Have You tried something like that:

AUI().ready(function(A) {
        AUI().use('aui-dialog', 'aui-io', function(A) {
                var url = 'http://localhost/url';
    Liferay.Util.openWindow(
            {
                dialog: {
                    cache: false,
                    width:800,
                    modal: true
                },
                   id:'shahbaj',              
                uri: url
            }
        );
 Liferay.provide(
        window,
        'closePopup',
        function(popupIdToClose) {
            var dialog = Liferay.Util.getWindow(popupIdToClose);
			dialog.destroy(); // You can try toggle/hide whatever You want
        },
        ['aui-base','aui-dialog','aui-dialog-iframe']
    );
        }); 
});


You have to add Yours variables and namespaces, this is just a JS code injected on my local machine (Liferay 6.2)

Best regards
thumbnail
Shahbaj Maner, modificado 10 Anos atrás.

RE: How to close pop up in liferay 6.2

New Member Postagens: 11 Data de Entrada: 29/11/13 Postagens Recentes
Thanks Wojciech Tutro, Its working... I appreciate your hellp.. Thanks again!!!emoticon
thumbnail
Vernon Singleton, modificado 10 Anos atrás.

RE: How to close pop up in liferay 6.2

Expert Postagens: 315 Data de Entrada: 14/01/13 Postagens Recentes
Shahbaj Maner:
Still trying on it but could not come up with a appropriate solution!! Guys please assist me!!


Hi Shahbaj,

I'm not sure this is the right forum for this issue.
This forum is for folks with questions about using Java Server Faces on Liferay.

But I am also curious if this could be your issue ...
try putting this line in your WEB-INF/liferay-portlet.xml:

<requires-namespaced-parameters>false</requires-namespaced-parameters>

This problem has been affecting many portlets deploying into the Liferay Portal 6.2 release.
See this post for more details about namespaced parameters.

Hope that helps,
Vernon
thumbnail
Kyle Joseph Stiemann, modificado 10 Anos atrás.

Moved

Liferay Master Postagens: 760 Data de Entrada: 14/01/13 Postagens Recentes
Moved to Home > AlloyUI > English category.
Marcin Panfil, modificado 9 Anos atrás.

RE: How to close pop up in liferay 6.2

New Member Postagens: 6 Data de Entrada: 04/01/11 Postagens Recentes
Here is good article: http://www.marconapolitano.it/en/liferay/41-how-to-close-a-dialog-iframe-in-liferay-6-2.html. Maybe for someone will be helpful.