tmoreira2020
6/29/2011 - 4:55 PM

Liferay Alloy popup async

Liferay Alloy popup async

AUI().use('aui-dialog', function(A) {
    
        Liferay.YourPlugin = {

            closePopup: function() {
                var instance = this;

                var popup = instance._getPopup()

                if (popup) {
                    popup.hide();
                }
            },

            displayPopup: function(url, title) {
                var instance = this;

                var popup = instance._getPopup();

                popup.show();

                popup.set('title', title);

                popup.io.set('uri', url);
                popup.io.start();
            },

            _getPopup: function() {
                var instance = this;

                if (!instance._popup) {
                    instance._popup = new A.Dialog(
                        {
                            resizable: false,
                            width: 600,
                            xy: [15,15]
                        }
                    ).plug(
                        A.Plugin.IO,
                        {autoLoad: false}
                    ).render();
                }

                return instance._popup;
            }
        }
    }
);