Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-22554

Tree component - assign diffferent arrayCollectoin as dataprovider won't work if showRoot=false in particular case.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Adobe Flex SDK 4.5 (Release)
    • None
    • mx: Tree
    • None
    • Affected OS(s): Windows
      Language Found: English

    Description

      Steps to reproduce:
      1. Create two items like this:

      //note: both items have children items.
      private var _item1 : XML = new XML('<item label="item1"><item label="kid1"/></item>');
      private var _item2 : XML = new XML('<item label="item2"><item label="kid2"/></item>');

      and two arrayCollection(s):

      private var _dp1 = new ArrayCollection();
      private var _dp2 = new ArrayCollection();

      private function init() : void

      { //_dp1 only has one item. _dp1.addItem(_item1); // _dp2 has two items. _dp2.addItem(_item1); _dp2.addItem(_item2); }

      2. create a tree component with showRoot=false and labelField="@label"

      3. assign _dp1 to the tree --> "kid1" being displayed.

      4. assign _dp2 to the tree --> nothing being displayed.

      5. if you assign _dp2 to the tree first --> two items and kids will be displayed.

      The cause:
      The tree component intenrally set _hasRoot flag = true when the dataprovider is an ICollectionView and length is 1. (From the document of hasRoot() it says "Lists and arrays do not have root".)
      Note: everything works as expected if I passed in a XMLListCollection instead of ArrayCollection.

      Actual Results:

      Expected Results:

      Workaround (if any):

      Attachments

        Activity

          People

            Unassigned Unassigned
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: