Fórum

Liferay.PortletURL is undefined

Mahesh Narke, modificado 9 Anos atrás.

Liferay.PortletURL is undefined

Regular Member Postagens: 105 Data de Entrada: 11/10/13 Postagens Recentes
Hi
Want to implement:
I have two pages with one portlets each. On click on link i want to move from one 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;
			[b]	var portletURL = Liferay.PortletURL.createRenderURL();[/b]
				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" %>

Please let me know the possible reason for this.
thumbnail
Tanweer Ahmed ., modificado 1 Ano atrás.

RE: Liferay.PortletURL is undefined

Expert Postagens: 322 Data de Entrada: 11/03/10 Postagens Recentes
Hi Mahesh,

I do not see any problem in your code on LR6.2.

Maybe you can try using
AUI().use('aui-base','liferay-portlet-url','aui-node', function(A) {

-Tanweer
Mahesh Narke, modificado 9 Anos atrás.

RE: Liferay.PortletURL is undefined

Regular Member Postagens: 105 Data de Entrada: 11/10/13 Postagens Recentes
Actually this code is working fine on chrome but not on firefox and safari.
thumbnail
Andew Jardine, modificado 9 Anos atrás.

RE: Liferay.PortletURL is undefined

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Works for me on Chrome and Firefox -- I can't try safari as I am not on a mac.

Cache maybe?
Mahesh Narke, modificado 9 Anos atrás.

RE: Liferay.PortletURL is undefined

Regular Member Postagens: 105 Data de Entrada: 11/10/13 Postagens Recentes
Update:
I resolved the issue by brute force.


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

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 whether this is the perfect solution for the problem or not.
Expert please let us know.