shreyas
shreyas

Reputation: 1420

Creating tree panel in ExtJs 4.0

I want to build TreePanel from XML response. I am unclear about using TreeStore in TreePanel. Do we have to write our logic in tree panel to create parent/child structure.

Migration from ExtJS 3.0 to 4.0

@Chao : Thanks for reply. I saw that example and found useful. but my response XML is little different like:

 <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

Upvotes: 0

Views: 2826

Answers (1)

Chao
Chao

Reputation: 1058

There is a very good and basic example provided by Sencha http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/tree/xml-tree.html

"isLeaf" property defined in the XML makes a node child. if a node doesn't have that property it will be rendered as a parent.

Upvotes: 1

Related Questions