Fórum

Event in Liferay.Util.openWindow

thumbnail
sridhar iyer, modificado 11 Anos atrás.

Event in Liferay.Util.openWindow

Junior Member Postagens: 57 Data de Entrada: 27/02/09 Postagens Recentes
Hi
I am using Liferay.Util.openWindow for loading calendar portlet in a popup. I want to get hold of iframe element after the url loads in iframe. How to get that?? This is my code::

Liferay.Util.openWindow({
dialog: {
width: 960,
modal:true,
centered: true,
destroyOnClose: true,
on: {
close: function(event) {
var calendar =
new A.Calendar({
dates: [ new Date() ],
dateFormat: '%m-%d-%Y'
});
loadEvents(calendar.getFormattedSelectedDates());
}
},
after: {
render: function(evt) {
alert('dialog help');
}
}
},
id: dialogId,
title: 'Events',
uri:calendarURL
});

Thanks
thumbnail
sridhar iyer, modificado 11 Anos atrás.

RE: Event in Liferay.Util.openWindow (Resposta)

Junior Member Postagens: 57 Data de Entrada: 27/02/09 Postagens Recentes
Hi Found the answer

added

dialogIframe: {
on: {
load : function(evt) {
var data = this;
alert('Hope this works new');
var dailogElement = A.one("#" + dialogId);
dailogElement.remove();
}
}
},


:::::
Liferay.Util.openWindow({
dialog: {
width: 960,
modal:true,
centered: true,
destroyOnClose: true,
on: {
close: function(event) {
var calendar =
new A.Calendar({
dates: [ new Date() ],
dateFormat: '%m-%d-%Y'
});
loadEvents(calendar.getFormattedSelectedDates());
}
}
},
dialogIframe: {
on: {
load : function(evt) {
var data = this;
alert('Hope this works new');
var dailogElement = A.one("#" + dialogId);
dailogElement.remove();
}
}
},
id: dialogId,
title: 'Events',
uri:url
thumbnail
Riccardo Rotondo, modificado 10 Anos atrás.

RE: Event in Liferay.Util.openWindow

Junior Member Postagens: 29 Data de Entrada: 11/06/10 Postagens Recentes
Hi, I'm using the Liferay.Util.openWinow dialog but I'm struggling to understand how to close it. I understood that if inside I put button of type cancel I'm able to close it. But when I create another button to execute an action, I obtain the portlet loaded in the dialog instead of seeing the dialog closed and the parent page reloaded. Could you help me please?

Here my code:

file_entry_delete.jsp

<aui:script use="aui-dialog,aui-overlay-manager">
        var liferayw;
        Liferay.provide(
		window,
		'alertDelete',
		function(urlParam) {
			var instance = this;
			var url=urlParam;

				liferayw = Liferay.Util.openWindow(
					{
						cache: false,
                                                id: '<portlet:namespace />alertDeleteId',
						dialog: {
							align: Liferay.Util.Window.ALIGN_CENTER,
							after: {
								render: function(event) {
									this.set('y', this.get('y') + 50);
								}
							},
							width: 820
						},
						dialogIframe: {
							id: 'deleteIFrame',
							uri: url
						},
						title: Liferay.Language.get('cloud'),
						uri: url
					}
				);
		},
		['liferay-util-window']
	);

    </aui:script>            


delete.jsp

<aui:form action="${deleteURL}" name="deleteForm" method="post">
        <aui:button name="DeleteOk" type="submit" value="delete" />
        <aui:button name="DeleteCancel" type="cancel" value="cancel" />
    </aui:form>


Thank you for your help
richard naoufal, modificado 10 Anos atrás.

RE: Event in Liferay.Util.openWindow

Junior Member Postagens: 34 Data de Entrada: 04/04/13 Postagens Recentes
Hello,

Did you find a solution for closing the window ?

Thank you for your help.
thumbnail
Riccardo Rotondo, modificado 10 Anos atrás.

RE: Event in Liferay.Util.openWindow

Junior Member Postagens: 29 Data de Entrada: 11/06/10 Postagens Recentes
Hi Richard, yes I did. I used an aui:script


<aui:script use="aui-dialog">
 
window.showDeleteFileAlert= function(id) {        
       var dialog = new A.Dialog({
           title: "<liferay-ui:message key="file-delete-popup" />",
           bodyContent: AUI().one('#<portlet:namespace />deleteAlertDiv_' + id),
           centered: true,
           modal: true,
           close: true,
       }).render();
    } 
</aui:script>


and then I defined the content:

<div style="display:none;">
    <div class="portlet-msg-alert" id="<portlet:namespace />deleteAlertDiv_<%= alertId %>">
    <h3>
        <liferay-ui:message key="file-confirm" />: 
        "&lt;%= FileLocalServiceUtil.getFile(fileId).getName()  %&gt;"
    </h3>
    <liferay-ui:message key="undo-impossible" />
    
    <portlet:actionurl var="deleteURL" name="delete">
            <portlet:param name="fileId" value="<%= Long.toString(fileId) %>" />
    </portlet:actionurl>
    <aui:form action="${deleteURL}" name="deleteForm" method="post">
        <aui:button name="DeleteOk" type="submit" value="delete" />
        <aui:button name="DeleteCancel" type="cancel" value="cancel" />
    </aui:form>
    </div>
    
</div>



If you want to check the entire code go here:

http://sourceforge.net/p/ctsciencegtwys/einfsrv/sources/HEAD/tree/trunk/einfrsrv-portlet/docroot/jsps/data/

Regards,

Riccardo