Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Liferay Open URL in Popup Dialog

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 1.23k
    Comment on it

    If you have requirement to open page in Popup Dialog instead of new page you can use following code. This look more professional and keep the user on same page. This is helpful in showing content like user details or payment records etc.

    In order to open the popup dialog in liferay you need to give .use-dialog class to the hyper link. And add following code in the main.js of your theme. This will also helpful in case you want to have this functionality in multiple pages hence you just need to have .use-dialog class to the corresponding hyper link and code to open dialog is already there in theme js.

    AUI().ready(
     function() {
         AUI().all('.use-dialog').on('click', function(event) {
             var url = event.currentTarget.get('href');
             var title = event.currentTarget.get('title');
             event.preventDefault();
    
           Liferay.Util.openWindow({
                dialog : {
                    align : {
                        points : [ 'tc', 'tc' ]
                   },
                    width : '95%'
                },
                title : title,
                uri : url
            });
        });
    });
    

    You will add the .use-dialog class to your hyper-link as shown below. You can this class to any other click-able field type also.

    <a class="use-dialog" title="Google Page" href="http://www.google.com">View</a>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: