jQuery MiniUI

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

mini-tabs 动态添加tab及outlooktree 获取不到 outlooktree [复制链接]

Rank: 1

跳转到指定楼层
楼主
发表于 2015-3-15 16:25:36 |只看该作者 |倒序浏览
var list = [
         { id: "base", text: "Base" },            
         { id: "ajax", text: "Ajax", pid: "base" },
         { id: "json", text: "JSON", pid: "base" },
         { id: "date", text: "Date", pid: "base" },
         { id: "control", text: "Control", pid: "base" },
         { id: "forms", text: "Forms", pid: "base" },
         { id: "button", text: "Button", pid: "forms" },
         { id: "listbox", text: "ListBox", pid: "forms" },
         { id: "checkboxlist", text: "CheckBoxList", pid: "forms" },
            { id: "lists", text: "Lists" },
         { id: "datagrid", text: "DataGrid", pid: "lists" },
         { id: "tree", text: "Tree", pid: "lists" },
         { id: "treegrid", text: "TreeGrid ", pid: "lists" }
        ];

  var item = json;
                        var tab = { title: item.OrgValue };
                        tab = tabs1.addTab(tab);
                        var el = tabs1.getTabBodyEl(tab);
                          el.innerHTML = '<div id="leftTree' + i + '" class="mini-outlooktree"  ' +
                                       '' +
                                       ' textField="name"' +
                                       ' idField="id" ' +
                                 
                                       
                                       ' parentField="pid" >' +
                                       '</div>';
                        mini.parse();
                 var tex = mini.get("leftTree' + i + '");
      
                    tex.loadList(list ,"id", "pid");

Rank: 8Rank: 8

沙发
发表于 2015-3-16 09:38:07 |只看该作者
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4.     <title></title>
  5.     <script src="../../scripts/boot.js" type="text/javascript"></script>
  6. </head>
  7. <body>
  8. <button onclick="addTab()">addTab</button>
  9. <div id="tabs1" class="mini-tabs" style="width:400px;height:300px">
  10.      
  11. </div>
  12. </body>
  13. </html>
  14. <script type="text/javascript">
  15.     var list = [
  16.          { id: "base", text: "Base" },
  17.          { id: "ajax", text: "Ajax", pid: "base" },
  18.          { id: "json", text: "JSON", pid: "base" },
  19.          { id: "date", text: "Date", pid: "base" },
  20.          { id: "control", text: "Control", pid: "base" },
  21.          { id: "forms", text: "Forms", pid: "base" },
  22.          { id: "button", text: "Button", pid: "forms" },
  23.          { id: "listbox", text: "ListBox", pid: "forms" },
  24.          { id: "checkboxlist", text: "CheckBoxList", pid: "forms" },
  25.             { id: "lists", text: "Lists" },
  26.          { id: "datagrid", text: "DataGrid", pid: "lists" },
  27.          { id: "tree", text: "Tree", pid: "lists" },
  28.          { id: "treegrid", text: "TreeGrid ", pid: "lists" }
  29.         ];
  30.     mini.parse()
  31.     function addTab() {
  32.         var tabs1 = mini.get("tabs1");
  33.         var tab = { title: "tab1" }
  34.         tabs1.addTab(tab);
  35.         tabs1.activeTab(tab);
  36.         var el = tabs1.getTabBodyEl(tab);
  37.         el.innerHTML = '<div id="leftTree1" class="mini-outlooktree" ></div>';
  38.         mini.parse();
  39.         var tree = mini.get("leftTree1")
  40.         tree.loadList(list, "id", "pid");
  41.     }
  42. </script>
复制代码
按你的代码可以生成

Archiver|普加软件

GMT+8, 2025-7-12 22:18 , Processed in 1.043730 second(s), 9 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部