Liferay Popups
1. Displaying content as pop up
<script>
function showDependancyPopup() {
var content = $('#id').html();
AUI().use('aui-base', 'aui-io-plugin-deprecated',
'liferay-util-window', function(A) {
var popUpWindow = Liferay.Util.Window.getWindow({
dialog : {
centered : true,
constrain2view : true,
modal : true,
resizable : false,
width : 600,
bodyContent : content,
buttons:[{
text:'OK',handler:function() {
this.close(); }
}]
}
}).plug(A.Plugin.IO, {
autoLoad : false
}).render();
popUpWindow.show();
popUpWindow.titleNode.html("Title");
});
}
</script>
2. Displaying JSP as pop up.
<script>
Liferay.provide(window, '<portlet:namespace />popup', function(){
var popUpWindow=Liferay.Util.Window.getWindow(
{
dialog: {
centered: true,
constrain2view: true,
//cssClass: 'yourCSSclassName',
modal: true,
resizable: false,
width: 350,
height: 350
},
id : 'popupId'
}
).plug(A.Plugin.IO, {
autoLoad : false
}).render();
popUpWindow.show();
popUpWindow.io.set('uri', url);
popUpWindow.titleNode.html("Title");
popUpWindow.io.start();
});
</script>
where url is render url.
3. Closing the popup
AUI().use('aui-base','aui-io-plugin-deprecated','liferay-util-window',
function(A) {
var dialog = Liferay.Util.getWindow("popupId");
dialog.destroy();
});
<script>
function showDependancyPopup() {
var content = $('#id').html();
AUI().use('aui-base', 'aui-io-plugin-deprecated',
'liferay-util-window', function(A) {
var popUpWindow = Liferay.Util.Window.getWindow({
dialog : {
centered : true,
constrain2view : true,
modal : true,
resizable : false,
width : 600,
bodyContent : content,
buttons:[{
text:'OK',handler:function() {
this.close(); }
}]
}
}).plug(A.Plugin.IO, {
autoLoad : false
}).render();
popUpWindow.show();
popUpWindow.titleNode.html("Title");
});
}
</script>
2. Displaying JSP as pop up.
<script>
Liferay.provide(window, '<portlet:namespace />popup', function(){
var popUpWindow=Liferay.Util.Window.getWindow(
{
dialog: {
centered: true,
constrain2view: true,
//cssClass: 'yourCSSclassName',
modal: true,
resizable: false,
width: 350,
height: 350
},
id : 'popupId'
}
).plug(A.Plugin.IO, {
autoLoad : false
}).render();
popUpWindow.show();
popUpWindow.io.set('uri', url);
popUpWindow.titleNode.html("Title");
popUpWindow.io.start();
});
</script>
where url is render url.
3. Closing the popup
AUI().use('aui-base','aui-io-plugin-deprecated','liferay-util-window',
function(A) {
var dialog = Liferay.Util.getWindow("popupId");
dialog.destroy();
});
Comments
Post a Comment