摘要:dojo-dijit tree選單
<script type="text/javascript" src="/dojo/dojo/dojo.js" djConfig="isDebug:true,parseOnLoad: true,bindEncoding:'UTF-8'"></script> <link href="/dojo/dijit/themes/tundra/tundra.css" rel="stylesheet" type="text/css" />
<link href="/dojo/dojo/resources/dojo.css" rel="stylesheet" type="text/css" />
<body class="tundra">
<script language="JavaScript" type="text/javascript">
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dijit.Tree");
dojo.require("dojo.parser");
</script>
<!-- -->
<div dojoType="dojo.data.ItemFileReadStore" jsId="continentStore"
url="/dojo/dojo/countries.json"></div>
<h3><font size=2 color=red>所屬單位:<已計算完值>(<已計算完值>)</font></h3>
<div dojoType="dijit.Tree" id="tree1" store="continentStore" query="{type:'continent'}"
labelAttr="name" label="Continents">
<script type="dojo/method" event="onClick" args="item">
if(item){
//alert("Type:" + continentStore.getLabel(item,"type"));
if (continentStore.getValue(item, "type")=="country"){
var tagtmp=window.location.target=continentStore.getValue(item, "Tag");
if (tagtmp=="Top"){top.window.location =continentStore.getValue(item, "locatoin");}
else if(tagtmp=="Body"){window.parent.Body.location.href =continentStore.getValue(item, "locatoin");}
}
//top.window.location=continentStore.getValue(item, "locatoin");}
// alert("Execute of node " + continentStore.getLabel(item)
// +", locatoin=" + continentStore.getValue(item, "locatoin"));
}else{
//alert("Execute on root node");
}
</script>
</div>
</body>
附件:countries.json:
{ identifier: 'name',
label: 'name',
items: [
{ name:'新增資料', type:'continent',
children:[{_reference:'新公告'}] },
{ name:'新公告', type:'country',locatoin:'./FBBS101M01?OpenForm',Tag:'Top' },
{ name:'檢視公告', type:'continent',
children:[{_reference:'公告中'}, {_reference:'草稿公告'},{_reference:'過期公告'}] },
{ name:'公告中', type:'country',locatoin:'./VPD001?OpenForm',Tag:'Body' },
{ name:'草稿公告', type:'country' ,locatoin:'./VPD002?OpenForm',Tag:'Body'},
{ name:'過期公告', type:'country',locatoin:'./DocOldView?OpenView',Tag:'Body' },
{ name:'Admin', type:'continent',
children:[{_reference:'所有文件'},{_reference:'相片測試'}] },
{ name:'所有文件', type:'country',locatoin:'./VAllDoc?OpenView' ,Tag:'Body'}
, { name:'相片測試', type:'country',locatoin:'./DojoImage?OpenPage',Tag:'Top'}, { name:'離開', type:'continent',locatoin:'/',Tag:'Top'}]}