0
votes

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.

1
Likely that the delayed-task not loading is causing the entire script to break. Your code, otherwise, looks good.rp.
I thought the same thing, but can't find any info on how to get that to load. there is a delayed-task folder under the Alloy folder in ROOT.war.nerdabilly
Also I have found issues.liferay.com/browse/LPS-13893 could be the cause of your problem and see that it is fixed in RC1. What version of 6.1 are you using?rp.
As far as I can tell, it's Liferay 6.0.6 bundled with JBoss.nerdabilly

1 Answers

1
votes

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.