I am trying to load external URL into modal AlloyUI dialog in Liferay Portal. If I open dialog at the first time the contents are showing but at the second time the contents are not showing. If refresh the page its showing.
This is my function:
Liferay.provide(
window,
'openModal',
function(title, url) {
var A = AUI();
var width = 800;
var modal = Liferay.Util.Window.getWindow({
dialog: {
centered: true,
constrain2view: true,
modal: true,
resizable: false,
height: 650,
width: width,
//destroyOnClose: true,
destroyOnHide: true,
toolbars: {
footer: [
{
label: 'Close',
cssClass: 'btn-link pull-right',
on: {
click: function() {
modal.hide();
}
}
}
]
}
},
closeOnOutsideClick: true,
id:'test-dialog',
title: title
}).plug(A.Plugin.IO, {
uri: url,
on: {
success: function(event) {
console.log("success");
},
complete: function(event) {
console.log("complete");
},
start: function(event) {
console.log("start");
},
failure: function(event) {
console.log("failure");
}
}
}).render();
}
);
The function is used in this link:
<a href="javascript:openModal('${title}','${url}');">Open dialog</a>
When I open dialog at the second time I get this error:
Cannot read property 'Window' of undefined
Resolved by using A.Plugin.DialogIframe
module insted of A.Plugin.IO