diji.Tree + JsonRestStore - 选择节点编程与tree.set("路径"节点、路径、JsonRestStore、Tree

由网友(所遇皆良人)分享简介:我有这个问题。我使用的是与dojox.data.JsonRestStore dijit.Tree作为数据源。所有节点都延迟加载。当我尝试使用tree.set以编程方式选择一个节点(路径,[1,2]),我得到一个错误说无法在不确定的扩张路径I've this problem. I'm using dijit.Tree...

我有这个问题。我使用的是与dojox.data.JsonRestStore dijit.Tree作为数据源。所有节点都延迟加载。当我尝试使用tree.set以编程方式选择一个节点(路径,[1,2]),我得到一个错误说无法在不确定的扩张路径

I've this problem. I'm using dijit.Tree with dojox.data.JsonRestStore as datasource. All nodes are lazy loaded. When I try to programmatically select a node using tree.set("path", [1,2]) I get an error saying "Could not expand path at undefined"

时有可能使用tree.set(路径...)时,树结构正在被动态装载

Is it possible to use tree.set("path"...) when the tree structure is being loaded dynamically ?

我的code包含2个文件。 source.php是数据源的实施

My code contains 2 files. source.php is the implementation of data source

tree.php可以在这里找到 http://jsfiddle.net/hd2MZ/2/

tree.php is available here http://jsfiddle.net/hd2MZ/2/

source.php可以在这里找到 http://jsfiddle.net/6zu3d/

source.php is available here http://jsfiddle.net/6zu3d/

请帮忙:)

推荐答案

我看到一对夫妇潜在的问题...

I see a couple potential issues...

您需要指定起根节点的路径所需的节点。 您正在使用的 ForestStoreModel 初始化模式,在 ForestStoreModel 按当它创建在幕后根节点,因为你没有指定ID为根节点默认情况下将使用的$根$ 的作为ID的根节点。 我相信ID的数据存储中的项目都串......不是整数。 You need to specify the path to the desired node starting at the root node. You are using the ForestStoreModel which creates a root node under the covers, since you did not specify the id for the root node when initializing the model, the ForestStoreModel by default will use '$root$' as the id for the root node. I believe id's for items in the data store are strings... not integers.

...如果你想设置的路径我会尝试以下方法:

... where you are trying to set the path I would try the following:

tree.set("path", ['$root$', '1', '2']);
阅读全文

相关推荐

最新文章