论坛首页 Web前端技术论坛

求助,EXT的Tree

浏览 5390 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2007-04-24  
页面
<div id="main-ct" style="width:100%;height:100%;"></div>


脚本
Ext.onReady(function(){
    var xt = Ext.tree;

    // turn on quick tips
    Ext.QuickTips.init();

    var cview = Ext.DomHelper.append('main-ct',
        {cn:[{id:'main-tb'},{id:'cbody'}]}
    );


    // create our layout
    var layout = new Ext.BorderLayout('main-ct', {
        center: {
            title:'Components',
            margins:{left:3,right:3,bottom:3,top:3}
        }
    }, 'main-ct');

    layout.batchAdd({
       center : {
           el: cview,
           autoScroll:true,
           fitToFrame:true,
           resizeEl:'cbody'
       }
    });



    // the component tree
    var ctree = new xt.TreePanel('cbody', {
        animate:true,
        enableDD:true,
        containerScroll: true,
        lines:false,
        rootVisible:false
    });


    var croot = new xt.AsyncTreeNode({
        allowDrag:false,
        allowDrop:false,
        id:'croot',
        text:'Packages and Components',
        cls:'croot',
        loader:new Ext.tree.TreeLoader({
            dataUrl:'/tmp1.json'
        })
    });
    ctree.setRootNode(croot);
    ctree.render();
    croot.expand();

});


JSON文件
[{"text":"profil1@anonyme.ca",
   "id":"10\/1",
   "cls":"cmp",
   "leaf":false,
   "children":[{"text":"Favoris",
                     "id":"10\/1\/favoris",
                     "cls":"cmp",
                     "leaf":false,
                     "children":[{"text":"une Fiche",
                                       "id":"10\/1\/favoris\/idFiche",
                                       "cls":"cmp",
                                       "leaf":true,
                                       },
                                     {"text":"un sous-dossier de Favoris",
                                       "id":"10\/1\/favoris\/sousDossier",
                                       "cls":"cmp",
                                       "leaf":false, 
                                       "children":[{"text":"une Fiche",
                                                         "id":"10\/1\/favoris\/idFiche",
                                                         "cls":"cmp",
                                                         "leaf":true}]
                                      }]
                     },
                     {"text":"Poubelle",
                       "id":"10\/1\/poubelle",
                       "cls":"cmp",
                       "allowDrop":true,
                       "leaf":true}
                     ]
}]



我运行这个例子,在firefox下正常显示,而IE下却什么都不显示,看一下。谢谢了
   发表时间:2007-04-24  
js 代码
  1. {"text":"une Fiche",      
  2. "id":"10\/1\/favoris\/idFiche",      
  3. "cls":"cmp",      
  4. "leaf":true,      
  5. }   

把 "leaf":true, 后面的逗号去掉

2 请登录后投票
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics