11 November, 2011

Popup

Below code will helpful to create popup in liferay :
In Liferay 5 :
<portlet:renderURL var="somePageURL" windowState="<%= LiferayWindowState.POP_UP.toString() %>">
 <portlet:param name="jspPage" value="/jsp/some/page.jsp"/>
 <portlet:param name="redirect" value="<%= currentURL %>"/>
</portlet:renderURL>

<script>
function showPopup() {
  var popup = new Liferay.Popup({
    title: 'Popup Title',
    modal:true,
    width: 300,
    position:['center',30],
    url: '<%= somePageURL %>'
  });    
}
</script>
 <a href="javascript: showPopup(); ">Click here to open popup  </a>  

In Liferay 6 :

<portlet:renderURL var="somePageURL" windowState="<%= LiferayWindowState.EXCLUSIVE.toString() %>">
  <portlet:param name="jspPage" value="/jsp/some/page.jsp"/>
  <portlet:param name="redirect" value="<%= currentURL %>"/>
</portlet:renderURL> 
 <script type="text/javascript">
function showPopup() {
  AUI().use('aui-dialog', 'aui-io', 'event', 'event-custom', function(A) {
   
    var dialog = new A.Dialog({
            title: 'Popup Title',
            centered: true,
            draggable: true,
            modal: true
        }).plug(A.Plugin.IO, {uri: '<%= somePageURL %>'}).render();
       
        dialog.show();
       
  });
} 

Waiting ??????????   We are done with popup code!!!! 

Popular Posts

Featured Post

Liferay 7.3 compatibility matrix

Compatibility Matrix Liferay's general policy is to test Liferay Portal CE against newer major releases of operating systems, open s...