Fórum
PopUp in liferay 6.0.6 not working
Danial Mustofa Habibi, modificado 12 Anos atrás.
PopUp in liferay 6.0.6 not working
Regular Member Postagens: 141 Data de Entrada: 01/11/11 Postagens Recentes
Hi there I'm trying to use pop up on liferay. based on this thread pop Up. but I Still no luck there's no pup showed
this is my jsp
and my MVC Class portlet method
and my PopUpjadwal.jsp
I'm trying to parse parameter using object so i can use search container in my pop up. did i missing something??Did i must use portletRender ? Can i just pass parameter directly to my popupjadwal.jsp without using my mvc class,
Thank's
Any help would be appreciated
regards
Danial
this is my jsp
<%@include file="/init.jsp"%>
<%@ page import="javax.portlet.PortletPreferences" %>
<portlet:actionurl name="showPopUp" var="showPopUpURL"></portlet:actionurl>
<%
String newPopup = "Liferay.test.displayPopup('" + showPopUpURL.toString() + "');";
%>
<aui:form action="<%= newPopup %>" method="post">
<aui:fieldset>
<aui:select name="tanggal" label="Tanggal">
<aui:option value="">
<liferay-ui:message key="silahkan-pilih"></liferay-ui:message>
</aui:option>
<aui:option value="18">
<liferay-ui:message key="Minggu, 18 Maret 2012"></liferay-ui:message>
</aui:option>
<aui:option value="19">
<liferay-ui:message key="Senin, 19 Maret 2012"></liferay-ui:message>
</aui:option>
<aui:option value="20">
<liferay-ui:message key="Selasa, 20 Maret 2012"></liferay-ui:message>
</aui:option>
</aui:select>
<aui:select name="kotaAsal">
<aui:option value="">
<liferay-ui:message key="silahkan-pilih"></liferay-ui:message>
</aui:option>
<aui:option value="bandung">
<liferay-ui:message key="Bandung"></liferay-ui:message>
</aui:option>
<aui:option value="jakarta">
<liferay-ui:message key="Jakarta"></liferay-ui:message>
</aui:option>
<aui:option value="Cirebon">
<liferay-ui:message key="Cirebon"></liferay-ui:message>
</aui:option>
</aui:select>
<aui:select name="kotaTujuan">
<aui:option value="">
<liferay-ui:message key="silahkan-pilih"></liferay-ui:message>
</aui:option>
<aui:option value="bandung">
<liferay-ui:message key="Bandung"></liferay-ui:message>
</aui:option>
<aui:option value="yogyakarta">
<liferay-ui:message key="YogyaKarta"></liferay-ui:message>
</aui:option>
<aui:option value="Surabaya">
<liferay-ui:message key="Surabaya"></liferay-ui:message>
</aui:option>
</aui:select>
</aui:fieldset>
<aui:button-row>
<aui:button type="submit" />
</aui:button-row>
</aui:form>
<script type="text/javascript">
AUI().use('aui-dialog', function(A) {
Liferay.test = {
closePopup: function() {
var instance = this;
var popup = instance._getPopup();
if (popup) {
popup.hide();
}
},
displayPopup: function(url) {
var instance = this;
var popup = instance._getPopup();
popup.show();
popup.io.set('uri', url);
popup.io.start();
},
_getPopup: function() {
var instance = this;
if (!instance._popup) {
instance._popup = new A.Dialog(
{
title: "Jadwal Keberangkatan Kereta",
resizable: false,
centered: true,
destroyOnClose: true,
width: 600,
xy: ['center',10]
}
).plug(
A.Plugin.IO,
{autoLoad: false}
).render();
}
return instance._popup;
}
}
});
</script>
and my MVC Class portlet method
public void showPopUp(ActionRequest request, ActionResponse response) throws PortalException,SystemException
{
String kotaAsal = ParamUtil.getString(request, "kotaAsal");
String kotaTujuan = ParamUtil.getString(request, "kotaTujuan");
String tanggal = ParamUtil.getString(request, "tanggal");
//JadwalkeretaImpl jadwalKereta =JadwalkeretaLocalServiceUtil.getJadwalByInput(kotaAsal, kotaTujuan, tanggal, start, end);
JadwalkeretaImpl jadwalKereta = new JadwalkeretaImpl();
jadwalKereta.setKotaAsal(kotaAsal);
jadwalKereta.setKotaTujuan(kotaTujuan);
jadwalKereta.setTanggal(tanggal);
log.info(kotaTujuan);
log.info(kotaAsal);
log.info(tanggal);
log.info("kotaTujuan "+jadwalKereta.getKotaTujuan());
request.setAttribute("jadwalKereta", jadwalKereta);
response.setRenderParameter("jspPage", jspJadwal);
protected String jspJadwal = "/html/jadwalkeberangkatanportlet/popUpJadwal.jsp";
}
and my PopUpjadwal.jsp
<%@page import="com.ka.rpll.portlet.service.JadwalkeretaLocalServiceUtil"%>
<%@page import="com.ka.rpll.portlet.model.impl.JadwalkeretaImpl"%>
<%@page import="com.ka.rpll.portlet.ActionUtil"%>
<%@page import="com.ka.rpll.portlet.model.Jadwalkereta"%>
<%@include file="/init.jsp"%>
<%@ page import="javax.portlet.PortletPreferences" %>
<%
JadwalkeretaImpl jadwalKereta = (JadwalkeretaImpl) request.getAttribute("jadwalKereta");
String kotaAsal = jadwalKereta.getKotaAsal();
String kotaTujuan = jadwalKereta.getKotaTujuan();
String tanggal = jadwalKereta.getTanggal();
System.out.println("kkkkkkk"+kotaAsal);
System.out.println(kotaTujuan);
System.out.println(tanggal);
%>
<aui:fieldset>
<liferay-ui:search-container emptyresultsmessage="Jadwal Yang Anda Cari Tidak Ditemukan" delta="10">
<liferay-ui:search-container-results>
<%
List<jadwalkereta> tempResults = JadwalkeretaLocalServiceUtil.getJadwalByInput(kotaAsal, kotaTujuan, tanggal, searchContainer.getStart(), searchContainer.getEnd());
for(Jadwalkereta j : tempResults)
{
System.out.println("Jam TIBAAAA "+j.getJamTiba());
}
results = ListUtil.subList(tempResults, searchContainer.getStart(), searchContainer.getEnd());
total = tempResults.size();
pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total);
%>
</jadwalkereta></liferay-ui:search-container-results>
<liferay-ui:search-container-row classname="com.ka.rpll.portlet.model.Jadwalkereta" keyproperty="id_keberangkatan" modelvar="jadwalKereta1">
<liferay-ui:search-container-column-text name="Nama Kereta" property="namaKereta" />
<liferay-ui:search-container-column-text name="Jam Berangkat" property="jamBerangkat" />
<liferay-ui:search-container-column-text name="Jam Tiba" property="jamTiba" />
<liferay-ui:search-container-column-text name="Jenis Kelas" property="jenisKelas" />
<liferay-ui:search-container-column-text name="Tarif" property="tarif" />
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
</aui:fieldset>
I'm trying to parse parameter using object so i can use search container in my pop up. did i missing something??Did i must use portletRender ? Can i just pass parameter directly to my popupjadwal.jsp without using my mvc class,
Thank's
Any help would be appreciated
regards
Danial
Mika Koivisto, modificado 12 Anos atrás.
RE: PopUp in liferay 6.0.6 not working
Liferay Legend Postagens: 1519 Data de Entrada: 07/08/06 Postagens Recentes
I think you should use renderURL instead of actionURL because from action phase you can't pass objects to render phase and you need to set windowState="<%= LiferayWindowState.POP_UP.toString() %>"
Danial Mustofa Habibi, modificado 12 Anos atrás.
RE: PopUp in liferay 6.0.6 not working
Regular Member Postagens: 141 Data de Entrada: 01/11/11 Postagens RecentesMika Koivisto:
I think you should use renderURL instead of actionURL because from action phase you can't pass objects to render phase and you need to set windowState="<%= LiferayWindowState.POP_UP.toString() %>"
Thank's for you answer , how I can pass all of my attributes to the pop up page? if i'm using render URL? can u give me some example?
Thank's
Regards
Danial
Juhi Kumari, modificado 12 Anos atrás.
RE: PopUp in liferay 6.0.6 not working
Expert Postagens: 347 Data de Entrada: 12/12/11 Postagens Recentes
Hi Danial,
I have achieve this feature in this way.
And from your render() in action class forward to you popup jsp.
Regards
Juhi
I have achieve this feature in this way.
<input type="button" value="PopUp" onclick="viewTermsConditions();">
<script type="text/javascript" charset="utf-8">
function viewTermsConditions() {
var slideShowWindow = window.open('<portlet:renderURL windowState="<%= LiferayWindowState.POP_UP.toString() %>"><portlet:param name="cmd" value="PopUp" /></portlet:renderURL>', 'slideShow', 'directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,height=640,width=680');
slideShowWindow.focus();
}
</script>
And from your render() in action class forward to you popup jsp.
Regards
Juhi