页面
<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":"[email protected]",
"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下却什么都不显示,看一下。谢谢了