0

我有 Liferay 对话框,我想关闭此对话框并希望将我的 url 重定向到一个页面。

我正在这样做。

<aui:column columnWidth="16" >

<%if(UserGroupRoleLocalServiceUtil.hasUserGroupRole(u.getUserId(), groupId, role.getRoleId())){ %>

<input value="delete" type="button"  onclick="document.location.href='
<portlet:actionURL name="deleteUserRole"><portlet:param name="memberId" value="<%= memberIdStr %>"/>
<portlet:param name="organization" value="<%=  Long.toString(organizationID) %>"/></portlet:actionURL>'"  />
    <%} %>
            </aui:column>


public void deleteUserRole(ActionRequest actionRequest,ActionResponse actionResponse){

// process to delete user role

    Role r = RoleLocalServiceUtil.getRole(org.getCompanyId(),
                    "Power User");


    UserGroupRoleLocalServiceUtil.deleteUserGroupRoles(userID, groupId, new long[] { r.getRoleId() });

        actionResponse.sendRedirect("/group/employee/empHome");                 


}

通过使用这种方式,当我单击删除按钮时,此方法会被调用,执行过程并重定向到此 url 但带有弹出窗口。

我想重定向到 actionResponse.sendRedirect 页面中的给定页面,但不在对话框中,它不应该在对话框中打开。

如何先关闭此对话框,然后将我的页面重定向到给定的 url?

我通过在链接上调用此类来打开对话框下面是我的 js 文件

/test.js/ _ _

 var myPopup;
AUI().ready( function() {

    if (AUI().one('#testing-menu')) {

    AUI().one('.extendClick').on(
        'mouseenter',
        function(event){
            AUI().one('.navi-type').setStyles({'display': 'none'});
            AUI().one('.extendClick').setStyles({'display': 'none'});
            AUI().one('.collapseArrow').setStyles({'display': 'block'});
        }
      );


   AUI().all('.employee-dialog').on(
        'click',
        function(event){
          var url = event.currentTarget.get('href');
          event.preventDefault();
          //console.info(url);

        window.myPopup= Liferay.Util.openWindow(
              {
                dialog: {
                  align: { points: ['tc', 'tc'] },
                  width: 960
                },
                title: 'Settings',
                uri: url
              }
            );
        }
      );


  }
});
4

2 回答 2

2

保存弹出窗口引用,稍后使用它关闭弹出窗口:

var myPopup;
AUI().all('.employee-dialog').on(
    'click',
    function(event){
      [..]
      myPopup = Liferay.Util.openWindow([...]);
    }
  );

使用保存的弹出参考onclick

<input value="delete" type="button" onclick="myPopup.close();document.location.href='
    [...]
于 2013-06-25T06:59:46.020 回答
0

最后,我能够以这种方式关闭此对话框。

<input value="delete" type="button"  onclick="javascript:closePopUp;document.location.href='
<portlet:actionURL name="deleteUserRole"><portlet:param name="memberId" value="<%= memberIdStr %>"/>
<portlet:param name="organization" value="<%=  Long.toString(organizationID) %>"/></portlet:actionURL>'"  />





<script type="text/javascript">
function closePopUp(){
top.document.getElementById('closethick').click();
}
</script>
于 2013-07-05T07:59:24.870 回答