我有一个弹出窗口的portlet。弹出窗口的内容没有改变,而是显示了点击它的同一页面。当我点击通知按钮弹出窗口显示但是有视图内容的.jsp。
所有代码都出现在view.jsp
中 <%@page import="com.mvantage.contract.model.Contract"%>
<%@ include file="/init.jsp" %>
<portlet:defineObjects />
<%
PortletURL actionURL1=renderResponse.createActionURL();
actionURL1.setParameter(ActionRequest.ACTION_NAME,"navigateDashboard");
ArrayList<Contract> contractParameterList= (ArrayList<Contract>)renderRequest.getAttribute("contract");%>
<portlet:renderURL var="contractURL" windowState="<%= LiferayWindowState.POP_UP.toString()%>">
<portlet:param name="jspPage" value="/html/popup.jsp" />
</portlet:renderURL>
<script type="text/javascript">
alert("Inside new popup");
function showPopup() {
AUI().use('aui-dialog', 'aui-io', 'event', 'event-custom', function(A) {
var dialog = new A.Dialog({
title: 'Pop Up',
centered: true,
draggable: true,
modal: true,
width: 500,
height: 500,
}).plug(A.Plugin.IO, {uri: '<%= contractURL %>'}).render();
dialog.show();
});
}
<div id="container">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example4">
<thead>
<tr>
<th>a</th>
<th>b/th>
<th>c</th>
<th>d</th>
<th>e</th>
<th>f</th>
<th>g</th>
</tr>
</thead>
<tbody>
<%for(int i=0; i<contractParameterList.size(); i++ ){
Contract contractParameter = new Contract();
contractParameter = (Contract)contractParameterList.get(i);
%>
<tr class="odd gradeX">
<td><%=contractParameter.getAssetName()%></td>
<%actionURL1.setParameter("assetId",contractParameter.getAssetID());%>
<td><a href="<%=actionURL1.toString()%>"><%=contractParameter.getAssetID()%></a></td>
<td><%=contractParameter.getCustomerName()%></td>
<td><%=contractParameter.getLocation()%></td>
<td><%=contractParameter.getRiskType()%></td>
<td><%=contractParameter.getContractNotificationTrigger()%></td>
<td><input class="notify" type="button" value="Notify" onclick="showPopup('<%=contractURL.toString()%>')"></td></tr> <%} %></tbody></table> <div style="clear:both;"></div></div>
答案 0 :(得分:0)
你使用A.Dialog的方式对我来说不是最好的。
尝试使用这种方式:http://alloyui.com/versions/1.7.x/examples/dialog/real-world/
答案 1 :(得分:0)
您好,您可以尝试以下简化代码:
<aui:button value="Pop Up" icon="av-icon" iconAlign="left"
type="button" onClick="displayPopUp()" cssClass="notify" />
<script type="text/javascript">
function displayPopUp(){
Liferay.Util.openWindow({dialog: {width: 500,height: 500,destroyOnHide: true}, title: 'Pop Up', uri: '<%=contractURL%>
'
});
}
</script>