我無法使focusNode()或expandNode()正常工作。我也嘗試切換回dojo 1.32甚至1.3,與1.4無差別。我用firebug進行調試,該節點是一個有效的樹節點,並且沒有發生錯誤,但節點不會集中注意力。幫助非常感謝!dijit樹和焦點節點
<head>
<script type="text/javascript">
dojo.declare("itcTree",[dijit.Tree], {
focusNodeX : function(/* string */ id) {
var node=this._itemNodesMap[id];
this.focusNode(node);
}
});
</script>
</head>
<body class="tundra">
<div dojoType="dojo.data.ItemFileReadStore" jsId="continentStore" url="countries.json">
</div>
<div dojoType="dijit.tree.ForestStoreModel" jsId="continentModel" store="continentStore"
query="{type:'continent'}" rootId="continentRoot" rootLabel="Continents"
childrenAttrs="children">
</div>
<div dojoType="itcTree" id="mytree" model="continentModel" openOnClick="true">
<script type="dojo/method" event="onClick" args="item">
dijit.byId('mytree').focusNodeX('AF');
</script>
</div>
<p>
<button onclick="dijit.byId('mytree').focusNode('DE');">klick</button>
</p>
</body>
感謝。我剛剛發現,如果使用focusNode(node [0]),上面的focusX函數就可以工作。 – MichaSchumann 2010-01-30 11:06:39