Foren

Passing Parameters to portlet:RenderURL using aui:script not working

thumbnail
Dushyant Tusharkant Dave, geändert vor 9 Jahren.

Passing Parameters to portlet:RenderURL using aui:script not working

Junior Member Beiträge: 43 Beitrittsdatum: 13.11.14 Neueste Beiträge
I am using Liferay 6.2 CE.
My requirement is to generate a POP_UP by onClick event of <a> link. In the POP_UP, I'm appending a next jsp file. Here, in the current jsp, I have a parameter to be passed on the next jsp(POP_UP). I have tried this aui:script,

<aui:script use="aui-io,aui-io-plugin-deprecated,liferay-util-window,aui-base">
Liferay.provide(
window,
'callPopUp',
function(param){
var A = AUI();

var renderURL = Liferay.PortletURL.createRenderURL();
renderURL.setPortletMode("view");
renderURL.setWindowState("pop_up");
renderURL.setParameter("page","/jsp-path"); //here we have tried "page", "jspPage" & "mvcPath"
renderURL.setParameter("param",param);

var callPopUp= Liferay.Util.Window.getWindow(
{
dialog: {
centered: true,
constrain2view: true,
modal: true,
resizable: false,
width: 475
}
}).plug(A.Plugin.DialogIframe,
{
autoLoad: true,
iframeCssClass: 'dialog-iframe',
uri: renderURL
}).render();
callPopUp.show();
callPopUp.titleNode.html("Pop Up title");
});
</aui:script>

but it's just generating next jsp file in POP_UP but I am not able to get the parameter I passed. Earlier in Liferay 6.1, I was using this aui:script,

<aui:script use="liferay-portlet-url,aui-io,aui-io-plugin-deprecated,liferay-util-window,aui-base">
Liferay.provide(
window,
'callPopUp',
function(param) {
var A = AUI();

var url = Liferay.PortletURL.createRenderURL();

url.setPortletMode("view");
url.setWindowState("pop_up");
url.setParameter("jspPage","/jsp-path");
url.setParameter("param",param);

var dialog = new A.Dialog({
modal: true,
title: 'Pop Up title',
height:600,
width:700,
resizable:true,
centered: true,
urlData: { windowState : 'LiferayWindowState.NORMAL'}
}).plug(A.Plugin.IO, {uri: url}).render();
dialog.show();
dialog.set('centered', true);
});
</aui:script>

it was working fine. I was able to get whichever parameter I parsed whether on jsp or on controller. Liferay 6.2 doesn't support "A.Dialog" and it was supported by Liferay 6.1, so I'm using "Liferay.Util.Window.getWindow". I'm not able to find the solution how to get the parameter to jsp file or to the controller by using aui:script in Liferay 6.2. Need Help on this?
thumbnail
Kyle Joseph Stiemann, geändert vor 9 Jahren.

Moved.

Liferay Master Beiträge: 760 Beitrittsdatum: 14.01.13 Neueste Beiträge
Moved to Home » Liferay Portal » English » 3. Development
thumbnail
Kyle Joseph Stiemann, geändert vor 9 Jahren.

RE: Passing Parameters to portlet:RenderURL using aui:script not working

Liferay Master Beiträge: 760 Beitrittsdatum: 14.01.13 Neueste Beiträge
Hi Dushyant,
Have you tried using AlloyUI's Modal component in place of AlloyUI Dialog? Note that the attributes may differ between these components but their functionality is very similar.

- Kyle
thumbnail
Dushyant Tusharkant Dave, geändert vor 9 Jahren.

RE: Passing Parameters to portlet:RenderURL using aui:script not working

Junior Member Beiträge: 43 Beitrittsdatum: 13.11.14 Neueste Beiträge
Hi Kyle,

Thanks for this earliest revert.

I have gone through your suggested link and the documentation for YUI (http://yuilibrary.com/yui/docs/panel/), but I am unable to find how to pass the URI using YUI.

If you have any real time solution how to set URI for renderURL in YUI, kindly revert back.

Thanks emoticon
thumbnail
Dushyant Tusharkant Dave, geändert vor 9 Jahren.

RE: Passing Parameters to portlet:RenderURL using aui:script not working

Junior Member Beiträge: 43 Beitrittsdatum: 13.11.14 Neueste Beiträge
Hey, is there anyone who can help me on this?

I have been stuck on this for so long.

Is there any suggestion/real-time solution for my question?

I'm eagerly waiting for a reply.
thumbnail
Andew Jardine, geändert vor 9 Jahren.

RE: Passing Parameters to portlet:RenderURL using aui:script not working

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
Hi Dushyant,

Can you trap the renderURL.toString() result and share it with us? Normally when I use the Liferay.PortletURL I have found that I need to include the plid and ppid in order for Liferay to know which portlet on which page to send the request to.
thumbnail
Tanweer Ahmed ., geändert vor 1 Jahr.

RE: Passing Parameters to portlet:RenderURL using aui:script not working

Expert Beiträge: 322 Beitrittsdatum: 11.03.10 Neueste Beiträge
Hi Dushyant,

I have achieved the same requirement with the below code.Hope it helps you.
<aui:script>
	
<portlet:renderurl var="importPagesURL" windowstate="<%= LiferayWindowState.POP_UP.toString() %>">
	<portlet:param name="jspPage" value="/popup.jsp" />
</portlet:renderurl>
	
	Liferay.provide(window, 'callPopUp', function(name) {

		var A = AUI();
		var dialog = Liferay.Util.Window.getWindow({
			dialog : {
				destroyOnHide : true,
				cssClass: 'lfr-add-dialog',
				width: 475
			},
			title : 'Pop Up title',
			uri: '&lt;%= importPagesURL.toString() %&gt;',
		});
		
		var data = Liferay.Util.ns(
				'<portlet:namespace />',{
					userName: name
				}
			);

		dialog.plug(
				A.Plugin.IO,
				{
					data: data,
					uri: '&lt;%= importPagesURL.toString() %&gt;'
				}
			);

	}, ['aui-io-plugin-deprecated', 'aui-io', 'liferay-util-window']);

</aui:script>

In popup.jsp :
&lt;%
String userName = ParamUtil.getString(request, "userName");
%&gt;


-Tanweer