jQuery MiniUI

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

使用tap和tree标签,在显示的时候,tab出现重复打开的页面 [复制链接]

Rank: 2

跳转到指定楼层
楼主
发表于 2014-3-15 14:41:35 |只看该作者 |倒序浏览

java:
public List<Tree> getTree(){
                List<Tree> treelist=new ArrayList();
                treelist.add(new Tree("100",null,"系统菜单导航",null,null,null));
                treelist.add(new Tree("110","100","新备案",null,"/pages/applyNewProduct.jsp",null));
                treelist.add(new Tree("120","100","复审",null,"/pages/ApplyFuhe.jsp",null));
                treelist.add(new Tree("130","100","备案查询",null,"/pages/applySearch.jsp",null));
                treelist.add(new Tree("133","100","退出",null,null,null));
                return treelist;
        }
jsp:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
        <head>
                <title>myindex.html</title>
                <link href="../demo/demo.css" rel="stylesheet" type="text/css" />
                <!--  <script src="../../minijs/index.js" type="text/javascript">-->
</script>
                <script src="../scripts/boot.js" type="text/javascript">
</script>
                <script type="text/javascript">
</script>
                <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>
        </head>
        <!-- 加载f()方法 -->
        <body>

                <div id="layout1" class="mini-layout"
                        style="width: 100%; height: 100%;">

                        <div class="header" region="north" height="34" showSplit="false"
                                showHeader="false">
                                <table width="96%">
                                        <tr>
                                                <td width="25%">

                                                </td>
                                                <td align=left width="35%">
                                                        <img src="../images/6.jpg" width="600px" height="20px">
                                                        <!--  <img src="../images/xws_title.jpg" >   -->


                                                </td>
                                                <td width="7%" align="left">
                                                       

                                                </td>
                                                <td width="10%">
                                                       
                                                </td>
                                                <td align="left" width="20%">
                                                         
                                                </td>
                                        </tr>


                                </table>
                        </div>
                       
                        <div title="center" region="center" bodyStyle="overflow:hidden;">
                                <!--Splitter-->
                                <div class="mini-splitter" style="width: 100%; height: 100%;"
                                        borderStyle="border:0;">
                                        <!--OutlookTree-->
                                        <div size="180" maxSize="250" minSize="100"
                                                showCollapseButton="true" style="border: 0;">
                                                 
                                                <div id="leftTree" class="mini-outlooktree"
                                                        url="../TreeController/getTree.do"
                                                        textField="text" idField="id" parentField="pid">
                                                </div>
                                        </div>

                                        <div showCollapseButton="false" style="border: 0;">
                                                <!--Tabs-->
                                                <div id="mainTabs" class="mini-tabs" activeIndex="2"
                                                        style="width: 100%; height: 100%;" plain="true">
                                                        <!--                                                        <div title="证书查询"-->
                                                        <!--                                                                url="../pagesarch.html">-->
                                                </div>
                                        </div>

                                </div>
                        </div>
                </div>
                <script type="text/javascript">
mini.parse();
var tree = mini.get("leftTree");
function sd(){
window.location
}
var tree = mini.get("leftTree");
function showTab(node) {
        var tabs = mini.get("mainTabs");
        var id = "tab$" + node.id;
        //添加注销
        if ("tab$133" == id) {
                mini.open( {
                        url : bootPATH + "../pages/page.html",
                        title : "注销",
                        width : 250,
                        height : 180
                });
        } else {

                var tab = tabs.getTab(id);
                if (!tab) {
                        tab = {};
                        tab.name = id;
                        tab.title = node.text;
                        tab.showCloseButton = true;
                        //这里拼接了url,实际项目,应该从后台直接获得完整的url地址
                        //tab.url = mini_JSPath + "../../docs/api/" + node.id + ".html";
                        //tab.url = mini_JSPath + "../../pages/search.html";       
                        tab.url = mini_JSPath + "../../" + node.url;
                        tabs.addTab(tab);
                }
                tabs.activeTab(tab);
        }
}
function onNodeSelect(e) {
        var node = e.node;
        var isLeaf = e.isLeaf;
       
        if (isLeaf) {
               
                showTab(node);
        }
}
//设置默认页面
function f() {
        var tabs = mini.get("mainTabs");
        var tab = tabs.getTab('tab$111');
        if (!tab) {
                tab = {};
                tab.name = 'tab$111';
                tab.title = "备案查询";
                tab.showCloseButton = true;
                tab.url = mini_JSPath + "../../pages/applySearch.jsp";
                tabs.addTab(tab);
        }

        tabs.activeTab(tab);
}
function onClick(e) {
        var text = this.getText();
        alert(text);
}
function onQuickClick(e) {
        tree.expandPath("datagrid");
        tree.selectNode("datagrid");
}

function shift(type) {
        var types;
        types = type;
        if (types == '1') {
                types = "zh_CN"
        } else if (types == '2') {
                types = "en_US"
        }
        var url = "../InternationalizationControl/InternationalShift.do?type="
                        + types;
        $.ajax( {
                url : url,
                type : "get",
                success : function(text) {
                window.location.href = "../pages/index.jsp";
        }
        });

}

function onSkinChange(skin) {
        mini.Cookie.set('miniuiSkin', skin, 100);//100天过期的话,可以保持皮肤切换
        window.location.reload()
}
function loginIsno(){
window.location.href="../LoginController/loginIsnot.do";
}

</script>
        </body>

</html>

Rank: 8Rank: 8

沙发
发表于 2014-3-15 20:15:42 |只看该作者
光贴代码,没数据没重新的,不好看
tabs.getTab(index/tabName) 是根据tab的名字或index获取的,估计是你这里的问题

Archiver|普加软件

GMT+8, 2025-7-10 13:36 , Processed in 1.027153 second(s), 9 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部