0 Replies Latest reply on Oct 9, 2007 8:22 AM by fhenckmann

    DisclosureIcon on empty branches in Tree

    fhenckmann
      Hello,
      I'm trying to display XML data in a tree. Because of the way the XML looks, I needed to write a custom data descriptor (I'll explain the XML structure at the end of the post) with custom hasChildren and isBranch methods.

      Now I've got the problem that everything works fine, but empty branches will still have the disclosure icon displayed. So apparently the data passed to the default itemRenderer is not "delivered" by the data descriptor - or the data descriptor delivers something to the renderer in a way that's incorrect.
      Either way, the TreeItemRenderer will show _listData.hasChildren to be true, while the data descriptor's hasChildren will show it to be false.

      Assuming the data descriptor is okay, is there any way to access the original XML from within a custom treeItemRenderer so that I can "check for children myself"?

      (on a second issue, I would also need to display a specific image with each tree leaf, depending on how an XML attribute of the leaf is set - similar to the Windows Explorer showing different icons for different file types - again, this would only work if I had access to the XML structure from within the renderer)

      Any help is much appreciated,
      cheers,
      Fabian

      XML Structure:
      Branches and Leaves are both received as <folder> tags. Both leaves and branches can have <property> tags, which are not to be displayed. The only difference between a branch and a leaf is that the leaves have a <property name='url'>url</property> tag, while the branches do not have property tags with a "name" attribute set to "url".
      Example:
      <folder id="thisIsTheRootFolder>
      <property name="someProp">someValue</property> /not to be displayed at all
      <folder id="firstSubfolder"> /this should be an empty subfolder
      <property name="someOtherProp">someOtherValue</property>
      </folder>
      <folder id="secondSubfolder">
      <folder id="thisIsALeaf">
      <property name="url"> http://www.adobe.com</property>
      </folder>
      </folder>
      </folder>