2

Want to implement: I have two pages with one portlet each. On click of link i want to move from first page portlet to another page portlet. For that i have written:

<aui:script>
 function openCompanyPage(companyId) {   
     AUI().use(
             'liferay-portlet-url',
             'aui-resize-iframe',
             function(A) {
                 var navigationURL;

var portletURL = Liferay.PortletURL.createRenderURL();

                 var url = themeDisplay.getLayoutURL();               
                portletURL.setParameter("employerId", companyId);
                portletURL.setPortletId(A.one('#custSupportPortletId'));
                navigationURL = portletURL.toString();
                window.location = navigationURL;
            }
    );

</aui:script> 

but i am getting error as Liferay.PortletURL is undefined on bold line. I have already provided :

    <%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
    <%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet"%>
<%@ taglib uri="http://liferay.com/tld/util" prefix="liferay-util"%>

Please let me know the possible reason for this.

OR What is other way to create the Render portlet URL.

mahesh
  • 909
  • 2
  • 18
  • 37

1 Answers1

1

Update: I resolved the issue by brute force.

Before: <a href="" onclick="openCDPPage('${individual.individualId}')">${individual.individualName} After :

<a onclick="openCDPPage('${individual.individualId}')">${individual.individualName}</a>

Changes in the script:

<script>
     function openCompanyPage(companyId) {   
         AUI().use(**'liferay-portlet-url'**,
                 function(A) {
                     var navigationURL;
        var portletURL = Liferay.PortletURL.createRenderURL();
                     var url = themeDisplay.getLayoutURL();               
                    portletURL.setParameter("employerId", companyId);
                    portletURL.setPortletId(A.one('#custSupportPortletId'));
                    navigationURL = portletURL.toString();
                    window.location = navigationURL;
                }
        );

    </script> 

This solved my issue. I am not sure whether this is the perfect solution for the problem or not. Expert please let us know.

mahesh
  • 909
  • 2
  • 18
  • 37