3
votes

I am trying show a portlet (that previously I have created) from another one, but the pop-up is empty. First, I create the renderURL:

<liferay-portlet:renderURL var="testPopupURL" portletName="<%=rule.getBannerPortletId() %>" windowState="<%=LiferayWindowState.POP_UP.toString() %>"></liferay-portlet:renderURL>

and I do the link:

<aui:a href="#" onClick="showPopup('${testPopupURL}')">View</aui:a> 

and this is the function showPopup:

    function showPopup(url){
    console.log("En el showPopup ");
    AUI().ready('aui-dialog', 'aui-io', 'event', 'event-custom', function(A) {
        window.myDialog  = new A.Dialog({
            title: 'Banner',
            width: 640,
            centered: true
        }).plug(A.Plugin.DialogIframe, {
                uri: url.toString(),
                iframeCssClass: 'dialog-iframe'
        }).render();
    });
}

I put in the liferay-portlet.xml (of the portlet I want open in the pop-up) this:

<add-default-resource>true</add-default-resource>

The portlet is instanciable and the bannerPortletId is the porletId.

Any idea?

Thanks

1
can you try "portlet_bannerPortletId_WAR_bannerPortletId_INSTANCE_d3Go" as portletName. - Pankaj Kathiriya
if I put it like portletName, the pop-up is empty too. Then I supose the Dialog is not catch the url? :S Thanks - sandra
which portlet is instanciable? the portlet inside pop-up or the portlet which is calling the pop-up? - Prakash K
If you are trying to display a JSF portlet in the pop-up, take a look at my answer here: stackoverflow.com/questions/35162383/… - stiemannkj1

1 Answers

3
votes

Finally I get display the portlet. I created the url with javascript:

    var url;
    function createRenderURL(portletId) {
    AUI().ready('liferay-portlet-url', function(A) {
        var renderURL = Liferay.PortletURL.createRenderURL();
        renderURL.setName("Banner");
        renderURL .setPortletMode("edit");
        renderURL .setWindowState("pop_up"); 
        renderURL.setPortletId(portletId);
    url = renderURL.toString();
    });
}

The code to show de pop-up is the same, but I pass the portletId like a parameter and call the function createRenderURL.

    var url;

function createRenderURL(portletId) {
    console.log("en el createRender");
    AUI().ready('liferay-portlet-url', function(A) {
        var renderURL = Liferay.PortletURL.createRenderURL();
        renderURL.setName("Banner");
        renderURL .setPortletMode("edit");
        renderURL .setWindowState("pop_up"); 
        renderURL.setPortletId(portletId);
        console.log(renderURL);
        url = renderURL.toString();
    });
}

I hope this can be useful for someone.