Question

I've been all over the Liferay sites and haven't found an answer that works. What I want to do is have a JavaScript function inside my custom portlet that will open an AUI dialog box, and that dialog box shows the view.jsp contents from an entirely separate portlet.

Here's what I've got so far:

AUI().ready('aui-dialog','aui-dialog-iframe','liferay-portlet-url', function(A) {
        var url = Liferay.PortletURL.createResourceURL();
        url.setPortletId("my_portlet_that_I_want_in_a_dialog");
        url.setWindowState('pop_up'); 

    #foreach ($parameter IN $parameters.getSiblings())
        url.setParameter("${parameter.data}", "${parameter.value.data}");
    #end  


    window.myDialog = new A.Dialog(
        {
            title: 'My Dialog',
            width: 640,
            centered: true
        }
    ).plug(
        A.Plugin.DialogIframe,
        {
            uri: url.toString(),
            iframeCssClass: 'dialog-iframe'
        }
    )
});

Then, in a completely different portlet, I've got a JavaScript function that calls:

window.myDialog.render()

This much works. However, when the dialog appears, it's always blank or infinitely shows a "Loading" animation.

Possibly related: In the Firebug console, I'm seeing

"yui: NOT loaded: delayed-task"

Not sure if that's related to the current problem or not. Thanks for the help.

EDIT: If I log the URL variable to the console, then copy and paste the URL into a new tab, the response is completely blank. This leads me to believe that I'm either not generating the URL correctly or there is some kind of inter-portlet permissions issue going on here.

Était-ce utile?

La solution

After 3 days of banging my head against the wall trying to figure this out, and digging through Liferay's abysmal documentation, the solution was pretty simple.

Instead of

url.setWindowState('pop_up'); 

It needed to be:

url.setWindowState('exclusive');

Once I did that, it worked perfectly.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top