jQuery MiniUI

 找回密码
 立即注册
查看: 2533|回复: 4
打印 上一主题 下一主题

使用removeAll无法关闭全部标签页 [复制链接]

Rank: 1

跳转到指定楼层
楼主
发表于 2014-4-14 08:30:43 |只看该作者 |倒序浏览
使用removeAll无法关闭全部标签页,只关闭了当前页和后面的页面点击关闭:


效果:


如果只有两页面的话就能全关闭,目标效果是1次关闭全部标签页
代码如下:
<%@ page language="java" pageEncoding="GBK"%>
<%
        String contextPath=request.getContextPath();
        String path = request.getContextPath();
        String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>1号</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <script src="<%=contextPath%>/htwyRes/miniui/scripts/boot.js" type="text/javascript"></script>
    <link href="<%=request.getContextPath() %>/htwyRes/miniui/scripts/miniui/themes/blue2003/skin.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    body{
        margin:0;padding:0;border:0;width:100%;height:100%;overflow: hidden;
    }   
    .header
    {
        background:url(../header.gif) repeat-x 0 -1px;
    }
    </style>
    <link href="<%=request.getContextPath() %>/htwyRes/orderNew/css/main.css" rel="stylesheet" type="text/css" />
</head>
<body style="background-color: #DEF0FE">
<input type="hidden" id="basePath" value="<%=basePath %>" />
<input type="hidden" id="paths" value="<%=path %>" />
<!--Layout-->
<div id="layout1" class="mini-layout" style="width:100%;height:100%;">
    <div class="header" region="north" height="70" showSplit="false" showHeader="false" >
        <h1 style="margin:0;padding:15px;cursor:default;display: none;">平台</h1>
        <div style="position:absolute;left: 10px;margin-top: 12px"><img src="images/bbbhead_title.png;" /></div>
        <div style="position:absolute;margin-top: 20px;right:250px;display: none;"> 搜索:<input /></div>
        <!-- 右上角 -->
        <div style="position:absolute;top:18px;right:10px;">
                <a class="mini-button" iconCls="top_right_3"  plain="true"><font color="white">黎明</font></a>
            <a class="mini-button" iconCls="icon-help" plain="true"><font color="white">帮助</font></a>   
            <a class="mini-button" iconCls="top_right_2"  plain="true" ><font color="white">收藏夹</font></a>
            <a class="mini-button" iconCls="top_right_2"  plain="true" ><font color="white">关闭</font></a>        
        </div>
    </div>
    <div title="south" region="south" showSplit="false" showHeader="false" height="30" >
        <div style="line-height:28px;text-align:center;cursor:default">22</div>
    </div>
          <div title="asdsa" iconCls="icon-add" showHeader="false" region="west" width="225" maxWidth="250" minWidth="100" showSplitIcon="true" expanded="true">
         <!-- 树 -->
           <td valign="top" style="width:300px;">
           <ul id="tree1" class="mini-tree" url="data/mainTree.txt" style="width:200px;padding:5px;"
               showTreeIcon="true" textField="text" idField="id" value="base" expandOnNodeClick="true"
               onnodeselect="onNodeSelect">        
           </ul>
       </td>
    </div>
    <!-- 打开加载 -->
    <div title="center" region="center" scrolling="no" >
           
        <div id="mainframe" class="mini-tabs" frameborder="0" name="main" style="width:100%;height:100%;overflow-x: hidden; overflow-y: hidden;" border="0"  onactivechanged="onTabsActiveChanged">
           <div title="首页" url="tender.jsp" >        
           </div>     
         </div>
    </div>
</div>
<script type="text/javascript">
    mini.parse();

    var tree = mini.get("leftTree");
    //树的点击事件
    function onNodeSelect(e) {
        var node = e.node;
        var isLeaf = e.isLeaf;
        if (isLeaf) {
            showTab(node);
        }
    }
  //标签页
  function showTab(node) {
            var tabs = mini.get("mainframe");

            var id = "tab$" + node.id;
            var tab = tabs.getTab(id);
            if (!tab) {
                tab = {};
                tab._nodeid = node.id;
                tab.name = id;
                tab.title = node.text;
                tab.showCloseButton = true;
                tab.url =  node.id + ".jsp";
                tabs.addTab(tab);
            }
            tabs.activeTab(tab);
        }
  //关闭标签
        function removeTab() {
         var tab = mini.get("mainframe");
          tab.removeAll(tab);
     }

    function onClick(e) {
        var text = this.getText();
        alert(text);
    }

    function onTabsActiveChanged(e) {
        var tabs = e.sender;
        var tab = tabs.getActiveTab();
        if (tab && tab._nodeid) {
            var node = tree.getNode(tab._nodeid);
            if (node && !tree.isSelectedNode(node)) {
                tree.selectNode(node);
            }
        }
    }

      //右上角事件
   function topRight(n){
           if(n==1){
                      url="shoppingCartWeek.jsp";
                      $('#mainframe').attr("src",url);
              }else if(n==2){
                      var url=$('#basePath').val();
                      window.external.addFavorite(url,'234')
              }else if(n==3){
                      mini.open({
              url: "/HIP/htwyRes/orderNew/help.jsp",
              title: "在线帮助", width: 500, height: 330,
              onload: function () {
                  //var iframe = this.getIFrameEl();
                  //var data = { action: "edit", id: row.id };
                  //iframe.contentWindow.SetData(data);
              },
              ondestroy: function (action) {
                  //grid.reload();
              }
          });
              }
   }
</script>
</body>
</html>

附件: 你需要登录才可以下载或查看附件。没有帐号?立即注册

Rank: 8Rank: 8

沙发
发表于 2014-4-14 09:24:24 |只看该作者
更新miniui看看,测试过了,removeAll()的话,全部都会被关闭掉的

Rank: 8Rank: 8

板凳
发表于 2014-4-14 09:26:34 |只看该作者
tab.removeAll(tab);   //加参数干什么??
removeAll(butTab)   //删除除butTab外的所有tab

Rank: 1

地板
发表于 2014-4-14 17:34:06 |只看该作者
问题是 树ID 和下面定义的错了- -

Rank: 8Rank: 8

5#
发表于 2014-4-14 17:59:55 |只看该作者
s9957 发表于 2014-4-14 17:34
问题是 树ID 和下面定义的错了- -

什么意思?

Archiver|普加软件

GMT+8, 2024-5-16 06:17 , Processed in 1.083974 second(s), 10 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部