我想从XML响应构建TreePanel。 我不清楚在TreePanel中使用TreeStore。 我们是否必须在树面板中编写逻辑以创建父/子结构。
Migration from ExtJS 3.0 to 4.0
@Chao:谢谢你的回复。我看到那个例子,发现很有用。但是我的回答XML差别不大,如:
<Root>
<Folder>
<CreateDate>Jun 6, 2011</CreateDate>
<CreatedBy>1000</CreatedBy>
<Files/>
<FolderName>Root folder</FolderName>
<Folders>
<Folder>
<CreateDate>Nov 30, 2011</CreateDate>
<FolderName>child folder 1 </FolderName>
<Folders/>
<Id>13</Id>
<ParentFolderId>1</ParentFolderId>
</Folder>
<Folder>
<FolderName>child folder 2</FolderName>
<CreateDate>Dec 1, 2011</CreateDate>
<Folders>
<Folder>
<FolderName>sub child folder</FolderName>
<CreateDate>Dec 1, 2011</CreateDate>
<Folders/>
<Id>27</Id>
<ParentFolderId>25</ParentFolderId>
</Folder>
</Folders>
<Id>25</Id>
<ParentFolderId>1</ParentFolderId>
</Folder>
</Folders>
<Id>1</Id>
<ModBy/>
<ModDate/>
<ParentFolderId/>
</Folder>
</Root>
and want to build tree from this response.
In extjs 3.0 the tree structure for this response was like:
Root
|__child folder 1
|__child folder 2
|__sub child folder
答案 0 :(得分:1)
Sencha提供了一个非常好的基本示例 http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/tree/xml-tree.html
&#34; isLeaf&#34; XML中定义的属性使节点成为子节点。如果一个节点没有该属性,它将被渲染为父节点。