Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Srikanth komma
popup in generic portlet
March 7, 2012 3:14 AM
Answer

Srikanth komma

Rank: Junior Member

Posts: 32

Join Date: March 1, 2012

Recent Posts

I have a requirement that i have to open a popup to from my portlet ,i am using Liferay6.0.5 and my portlet is generic portlet.If i use the technic of using liferay popup its not working that means i am not getting the liferay portla API support in the popup.if i use renderURL that is also not working.Any Idea will be appreciated.

Thanks in advance....
Mayur Patel
RE: popup in generic portlet
March 7, 2012 3:48 AM
Answer

Mayur Patel

Rank: Expert

Posts: 350

Join Date: November 17, 2010

Recent Posts

you can make use of Alloy Dialog instead of Lifeary Popup and It will solve your issue.

This might help you,
Alloy Dialog Demo
Thanks
Srikanth komma
RE: popup in generic portlet
March 7, 2012 5:24 AM
Answer

Srikanth komma

Rank: Junior Member

Posts: 32

Join Date: March 1, 2012

Recent Posts

Hi Mayur,
Thanks for your time I think AlloyUI is suitable for show something with the existing data on the page but i want to construct portletURL and display the list of records using liferay search container.
Mayur Patel
RE: popup in generic portlet
March 7, 2012 11:48 PM
Answer

Mayur Patel

Rank: Expert

Posts: 350

Join Date: November 17, 2010

Recent Posts

I think if you generate Portal render URL and display that jsp that is constructed with list of records using search container, those data will be shown in popup

See this,
Popup in Liferay
Srikanth komma
RE: popup in generic portlet
March 23, 2012 6:48 AM
Answer

Srikanth komma

Rank: Junior Member

Posts: 32

Join Date: March 1, 2012

Recent Posts

Srikanth komma:
I have a requirement that i have to open a popup to from my portlet ,i am using Liferay6.0.5 and my portlet is generic portlet.If i use the technic of using liferay popup its not working that means i am not getting the liferay portla API support in the popup.if i use renderURL that is also not working.Any Idea will be appreciated.

Thanks in advance....

I got the solution as given below.
URL Construciton

<portlet:renderURL var="popUpURL" windowState="<%= LiferayWindowState.EXCLUSIVE.toString() %>">
<portlet:param name="viewJsp" value="/selectDefaultContext.jsp"/>
<portlet:param name="redirect" value="<%= redirect %>"/>
</portlet:renderURL>

<a href="#" onClick="javascript:showPopup('<%= popUpURL %>')" ><liferay-ui:message key="change" /></a></span>
Script
<script type="text/javascript">
function showPopup(url) {
AUI().use('aui-dialog', 'aui-io', 'event', 'event-custom', function(A) {
var dialog = new A.Dialog({
title: '<liferay-ui:message key="select-default-organization" />',
height:350,
width:500,
centered: true,
draggable: true,
modal: true
}).plug(A.Plugin.IO, {uri: url}).render();
dialog.show();
});
}
</script>

Override the path value in include method of action class

protected void include(String path, RenderRequest renderRequest,
RenderResponse renderResponse) throws IOException, PortletException {

if (renderRequest.getParameter("viewJsp") != null) {
path = renderRequest.getParameter("viewJsp");
}

PortletRequestDispatcher portletRequestDispatcher = getPortletContext()
.getRequestDispatcher(path);
if (portletRequestDispatcher == null) {
log_.error(path + " is not a valid include");
} else {
portletRequestDispatcher.include(renderRequest, renderResponse);
}
}
Mayur Patel
RE: popup in generic portlet
March 23, 2012 6:53 AM
Answer

Mayur Patel

Rank: Expert

Posts: 350

Join Date: November 17, 2010

Recent Posts

Thanks for sharing the solution !!!
Bella fernandis
RE: popup in generic portlet
December 20, 2012 9:59 PM
Answer

Bella fernandis

Rank: New Member

Posts: 15

Join Date: November 5, 2012

Recent Posts

Srikanth komma:
Srikanth komma:
I have a requirement that i have to open a popup to from my portlet ,i am using Liferay6.0.5 and my portlet is generic portlet.If i use the technic of using liferay popup its not working that means i am not getting the liferay portla API support in the popup.if i use renderURL that is also not working.Any Idea will be appreciated.

Thanks in advance....

I got the solution as given below.
URL Construciton

<portlet:renderURL var="popUpURL" windowState="<%= LiferayWindowState.EXCLUSIVE.toString() %>">
<portlet:param name="viewJsp" value="/selectDefaultContext.jsp"/>
<portlet:param name="redirect" value="<%= redirect %>"/>
</portlet:renderURL>

<a href="#" onClick="javascript:showPopup('<%= popUpURL %>')" ><liferay-ui:message key="change" /></a></span>
Script
<script type="text/javascript">
function showPopup(url) {
AUI().use('aui-dialog', 'aui-io', 'event', 'event-custom', function(A) {
var dialog = new A.Dialog({
title: '<liferay-ui:message key="select-default-organization" />',
height:350,
width:500,
centered: true,
draggable: true,
modal: true
}).plug(A.Plugin.IO, {uri: url}).render();
dialog.show();
});
}
</script>
Override the path value in include method of action class

protected void include(String path, RenderRequest renderRequest,
RenderResponse renderResponse) throws IOException, PortletException {

if (renderRequest.getParameter("viewJsp") != null) {
path = renderRequest.getParameter("viewJsp");
}

PortletRequestDispatcher portletRequestDispatcher = getPortletContext()
.getRequestDispatcher(path);
if (portletRequestDispatcher == null) {
log_.error(path + " is not a valid include");
} else {
portletRequestDispatcher.include(renderRequest, renderResponse);
}
}


Hey Srikanth komma, can you please guide me about your last step(Override the path value in include method of action class. I am a newbiee in liferay so not able to understand the concept of overriding the path.
Your any help will be appreciated.