Foros de discusión

Liferay.PortletURL is undefined

kuong knight, modificado hace 9 años.

Liferay.PortletURL is undefined

New Member Mensajes: 22 Fecha de incorporación: 9/05/14 Mensajes recientes
I use LR 6.2
When i click button the first is OK. but the seconde has error: Liferay.PortletURL is undefined>?
My code:

<button onclick="openOrder(0);">Test</button>
<aui:script>
	Liferay.provide(window,'openOrder',function(orderId){
		var popupURL = Liferay.PortletURL.createRenderURL();
		popupURL.setPortletId('&lt;%=portletId %&gt;');
		popupURL.setParameter('mvcPath', '/html/payments/view_order_detail.jsp');
		popupURL.setParameter('orderId', orderId);
		popupURL.setDoAsGroupId('&lt;%=groupId %&gt;');
		popupURL.setWindowState('pop_up');
	    openDialog({
			uri : popupURL.toString(),
			width : 700,
			height : 520,
			title:'Payment',
			id:'paymentDialog'
		});
		
	},['aui-base','liferay-portlet-url','aui-node'] );
	
	Liferay.provide(window,'openDialog',function(config){
		var A = AUI();
		 var popUpWindow=Liferay.Util.Window.getWindow({
				 dialog: {
					 centered: true,
					 constrain2view: true,
					 cssClass: 'dialogPayment',
					 modal: true,
					 resizable: false,
					 width: config.width,
					 height:config.height
				 	},
				 id: '<portlet:namespace />'+config.id,
			}).plug(A.Plugin.IO,
						{
					 		autoLoad: false
					 	}).render();
		 popUpWindow.show();
		 popUpWindow.titleNode.html(config.title);
		 popUpWindow.io.set('uri',config.uri);
		 popUpWindow.io.start();
		
	},['aui-base','liferay-util-window','aui-io-plugin-deprecated']);
	
</aui:script>
thumbnail
Pankaj Kathiriya, modificado hace 9 años.

RE: Liferay.PortletURL is undefined

Liferay Master Mensajes: 722 Fecha de incorporación: 5/08/10 Mensajes recientes
You have to use liferay-portlet-url module in your js code.
e.g.
<aui:script use="liferay-portlet-url">

</aui:script>