Fórum

Problem to Liferay popup and refresh portlet

Andres Gonzalez, modificado 9 Anos atrás.

Problem to Liferay popup and refresh portlet

New Member Postagens: 2 Data de Entrada: 17/11/13 Postagens Recentes
Hello people, i have the next problem:

i have two portlets
portlet A is just for information
in portlet B i use a Liferay popup , where i make ajax call and close the popup(that works fine) but i need refresh portlet A, so i add the code Liferay.Portlet.refresh(portlet id), that works fine only the first time , in second time when i call popup, he make the ajax call and refresh the portlet but he does not close popup, i get javascript error "Cannot read property 'destroy' of undefined ";

the problem apears when i use the code "Liferay.Portlet.refresh('#p_p_id_shoppingcartlist_WAR_ImpresistemWebportlet_');"

please helpme
Thanks a lot

Sry for my bad english
here my code:

AUI.namespace('shopWindowContent');
AUI()
		.use(
				'aui-base',
				'liferay-util-window',
				'io',
				function(A) {

					AUI.shopWindowContent.close = function(resourceURL) {
						var shoppingQuantity = A.one('#'+portletNamespace+'shoppingQuantity').get('value');
						var ajaxRequest = A.io.request(resourceURL,{
							method : 'POST',
							data : {_shopwindowcontent_WAR_ImpresistemWebportlet_shoppingQuantity:shoppingQuantity},
							on:{
								success : function(message){
									Liferay.Util
									.getOpener()
									.closeItemDetailsPopup(
											portletNamespace + 'itemDetailsPopup');
									
								}
							}
						});
						ajaxRequest.start();
						
					};

					AUI.shopWindowContent.showItemDetailsPopup = function(
							actionURL) {
						Liferay.Util.openWindow({
							dialog : {
								destroyOnHide: true,
								centered : true,
								constrain2view : true,
								cssClass : 'itemDetailsPopupCssStyle',
								modal : true,
								resizable : false,
								width : 800,
								height : 275
							},
							id : portletNamespace + 'itemDetailsPopup',
							title : "Informacion del Producto",
							autoLoad : true,
							iframeCssClass : 'itemDetailsPopup-iframe',
							uri : actionURL
						});

					};

					Liferay.provide(window,'closeItemDetailsPopup',
							function(dialogId) {
								Liferay.Portlet.refresh('#p_p_id_shoppingcartlist_WAR_ImpresistemWebportlet_');
								Liferay.Util.getWindow(dialogId).destroy();
							}, [ 'liferay-util-window' ]);

				});
thumbnail
Manali Lalaji, modificado 9 Anos atrás.

RE: Problem to Liferay popup and refresh portlet

Expert Postagens: 362 Data de Entrada: 09/03/10 Postagens Recentes
Hi,

Can you check whether you are getting dialogId of popup you are trying to close?

Also refer some threads: link1, link2

HTH!
Andres Gonzalez, modificado 9 Anos atrás.

RE: Problem to Liferay popup and refresh portlet

New Member Postagens: 2 Data de Entrada: 17/11/13 Postagens Recentes
Hi ,

i've check the dialogid and is ok in Liferay.getOpener function and Liferay.provide Function
i've make the example for link2 but im still getting error "Uncaught TypeError: Cannot read property 'destroy' of undefined " when function try to close popup but this time the second time than i use the popup this does not close , seems like reset instead close.



any other idea? Please!
TY