任何人都可以幫我弄清楚爲什麼在Dojo 1.8中工作而不是在1.9中?程序化Dijit/Tree沒有出現在聲明式Dijit/ContentPane中
在1.8中,該樹位於「pilotTreeContainer」內容窗格內。在1.9中,如果你看着Firebug,但是在視覺上,樹就在那裏,它只是顯示一個加載圖形。 pilotTreeContainer在包含此代碼的窗口小部件的模板文件中聲明。所有這些代碼都在postCreate
方法中。
var treeStore = lang.clone(store);
var treeModel = new ObjectStoreModel(
{
store: treeStore,
query: { id: 'all' },
mayHaveChildren: function (item) // only ships have the unique attribute
{
return item.unique === undefined;
}
});
var pilotTree = new Tree(
{
model: treeModel, // do we need to clone?
autoExpand: true,
showRoot: false,
title: 'Click to add',
openOnClick: true,
getDomNodeById: function (id) // new function to find DOM node
{
if (this._itemNodesMap !== undefined && this._itemNodesMap[ id ] !== undefined && this._itemNodesMap[ id ][0] !== undefined) {
return this._itemNodesMap[ id ][0].domNode;
}
else {
return null;
}
}
});
this.pilotTree = pilotTree;
this.pilotTreeContainer.set('content', pilotTree);
我已經嘗試在樹和內容面板上調用啓動。
調試dijit/Tree代碼,它看起來有一個延遲,永遠不會解決。當從_load函數中調用時,它會從_expandNode函數返回(當嘗試展開根節點this._expandNode(rn).then
時)。
在的dijit /樹失敗的部分是這樣的:
// Load top level children, and if persist==true, all nodes that were previously opened
this._expandNode(rn).then(lang.hitch(this, function(){
// Then, select the nodes specified by params.paths[].
this.rootLoadingIndicator.style.display = "none";
this.expandChildrenDeferred.resolve(true);
}));
爲什麼樹沒有顯示?出了什麼問題?
你可以用你的代碼創建一個小提琴嗎? – Richard
不容易。我將一個複雜的基於Dijit的項目從1.8遷移到1.9,這只是其中的一小部分。 – voidstate
你可以發佈整個小部件的代碼嗎? – Philippe