Fórum

Passing data onClick to a different page

Vaibhav Mittal, modificado 11 Anos atrás.

Passing data onClick to a different page

Junior Member Postagens: 54 Data de Entrada: 16/07/12 Postagens Recentes
I have built a search portlet which shows result in a table. One column of that table contains view hyperlink.

Now what I want is, when someone clicks on that view link, data from the result table gets passed to the new page and display result according to the data I am passing to the new page. Here new page should be same but display different result on clicking of different view links.
If someone can guide me the further steps.

Thnxx & Regards,
Vaibhav Mittal
thumbnail
Sid Sket, modificado 11 Anos atrás.

RE: Passing data onClick to a different page

New Member Postagens: 11 Data de Entrada: 20/02/12 Postagens Recentes
Hi Vaibhav,
I have done this using aui-dialog, passing the data to the calling popup based on the link clicked and the result will display accordingly.

Regards,
sid
thumbnail
Priyanka Dhingra, modificado 11 Anos atrás.

RE: Passing data onClick to a different page

Liferay Master Postagens: 501 Data de Entrada: 20/12/11 Postagens Recentes
you can use
<portlet:renderurl></portlet:renderurl>
thumbnail
Subhash Pavuskar, modificado 11 Anos atrás.

RE: Passing data onClick to a different page

Regular Member Postagens: 234 Data de Entrada: 13/03/12 Postagens Recentes
Hi Vaibhav Mittal ,

Adding more points to Priyanka Dingra's post !! try this code on your first page i.e page1.jsp to redirect to page2.jsp


<portlet:renderurl var="clickRenderURL">
<portlet:param name="jspPage" value="/WEB-INF/view/page2.jsp" />
</portlet:renderurl>

<a href="<%=clickRenderURL %>">Click here</a>


Hope this may help you !!
Ajeet Singh, modificado 11 Anos atrás.

RE: Passing data onClick to a different page

New Member Postagens: 14 Data de Entrada: 27/03/12 Postagens Recentes
You can achieve that using actionUrl as well as renderUrl. In your requirement, you are supposed to display different data, hence it is required to fetch data from some sorces. Hence you should go through actionUrl. You can get the parameter values like actionRequest.getParameter("employeeId") or rederRequest.getParameter("employeeId") in action phase or render phase respectively.

<div>
                <a href="<portlet:actionURL>
                                <portlet:param name=" employeeId" value="<%=employee.getEmployeeId()%>"></a>
                                <portlet:param name="employeeName" value="<%=employee.getEmployeeName()%>" />
                                <portlet:param name="employeeAddress" value="<%=employee.getEmployeeAddress%>" />
                        "&gt;
                
       </div>


<div>
                <a href="<portlet:renderURL>
                                <portlet:param name=" employeeId" value="<%=employee.getEmployeeId()%>"></a>
                                <portlet:param name="employeeName" value="<%=employee.getEmployeeName()%>" />
                                <portlet:param name="employeeAddress" value="<%=employee.getEmployeeAddress%>" />
                        "&gt;
                
       </div>


I hope that, you will get through this.

Regards,
Ajeet Singh
Vaibhav Mittal, modificado 11 Anos atrás.

RE: Passing data onClick to a different page

Junior Member Postagens: 54 Data de Entrada: 16/07/12 Postagens Recentes
Thnxx subhash, priyanka and Sid for your replly.
Sid, aui-dialog will open a dialog box on the same page but my requirement is to open the details on a new page.
<portlet:renderURL> will open a new jsp for sure but in the same portlet on the same page. This will just replace the old jsp and calls the new jsp using doview method. The same can be achieved by calling edit mode programatically on click(by changing mode).

I want to open this new jsp on a new page (on click), the way window.open() do opens up a new window. If this can be achieved?
thumbnail
Rajeeva Lochana .B.R, modificado 11 Anos atrás.

RE: Passing data onClick to a different page

Junior Member Postagens: 67 Data de Entrada: 04/01/10 Postagens Recentes
Hi Vaibhav,

Place the attribute target="_NEW" inside the anchor tag to open content in new window.

Check the below example



<portlet:renderurl var="JSPURL">
.....
</portlet:renderurl>

or
<portlet:actionurl var="JSPURL">
.....
</portlet:actionurl>


<a href="javascript:void(0);" onclick="<%= JSPURL.toString() %>" target="_NEW">View </a>

Gwowen Fu, modificado 11 Anos atrás.

RE: Passing data onClick to a different page

Expert Postagens: 315 Data de Entrada: 27/12/10 Postagens Recentes
Use <liferay-portlet:renderURL> will take you to the page where the portlet is placed.
thumbnail
Zeeshan Khan, modificado 11 Anos atrás.

RE: Passing data onClick to a different page

Expert Postagens: 349 Data de Entrada: 21/07/11 Postagens Recentes
Vaibhav Mittal:
I have built a search portlet which shows result in a table. One column of that table contains view hyperlink.

Now what I want is, when someone clicks on that view link, data from the result table gets passed to the new page and display result according to the data I am passing to the new page. Here new page should be same but display different result on clicking of different view links.
If someone can guide me the further steps.

Thnxx & Regards,
Vaibhav Mittal



Hi Vaibhav...

how u created this search portlet...?? can us share this.....??
I also have to create this search box on top of the banner of liferay.....