1
votes

I have portlet which is embedded like this inside web content:

runtime-portlet name="somePortletName" instance="54363734" queryString=""

It has custom jsp edit page which I would like to open in a popup window, because there is not enough space in place where this small portlet is embedded. How can I achieve this?

1
Which portlet is this? What version of liferay are you using?Parkash Kumar
Pass edit.jsp in <init-param> and add <portlet-mode>edit</portlet-mode> to <supports> in portlet.xml. Then in your action override doEdit method and include(editJSP, renderRequest, renderResponse); at the bottom of it.Parkash Kumar

1 Answers

-1
votes

I found a blog from Liferay and test it through my portal (Liferay 6.2 CE GA4). It works:

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://alloy.liferay.com/tld/aui" prefix="aui" %>
<%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%>

<portlet:defineObjects />


<portlet:renderURL var="PopupURL"  windowState="<%=LiferayWindowState.POP_UP.toString()%>">
    <portlet:param name="jspPage" value="/edit.jsp"/>
</portlet:renderURL>


<aui:button name="test-popup"  id="test-popup"  value="popup"> </aui:button>
 <aui:script>
 AUI().use('aui-base','liferay-util-window','aui-io-plugin-deprecated',function(A){

    A.one('#<portlet:namespace/>test-popup').on('click', function(event){
    var test_popup= Liferay.Util.Window.getWindow(
                {
                    dialog: {
                        centered: true,
                        constrain2view: true,
                          modal: true,
                        resizable: false,
                        width: 800
                    }
                }).plug(A.Plugin.DialogIframe,
                     {
                     autoLoad: true,
                     iframeCssClass: 'dialog-iframe',
                     uri:'<%=PopupURL.toString()%>'
                     }).render();
                    test_popup.show();
                    test_popup.titleNode.html("Login");


     });
 });
 </aui:script>

If you have multi-porlets in your project, simply change the value of parameter "jspPage" from "/edit.jsp" to "/html/[portlet_name]/edit.jsp" or a known url path.