Sounds complicated!

I think by data binding you mean getting at the extra data in the main list as 
you traverse the tree to it's leaves. If so instead of just having an array of 
strings you need to have an object that refers back to the entry (containing 
the extra information) in the original ArrayCollection. I would make that 
object have a label property and a reference back to the appropriate entry in 
the original AC. Use the label property as you would the current strings that 
you have.

Not sure if that helps you.

Paul
  ----- Original Message ----- 
  From: DannyT 
  To: flexcoders@yahoogroups.com 
  Sent: Friday, March 07, 2008 12:02 AM
  Subject: [flexcoders] list within list within list data proviers


  Please bear with me while i try to explain this:

  I have a custom dataItem:

  public class MyDataItem
  {
      public var Category:String;
      public var MainType:String;
      public var SubType:String;
      // some other properties
  }

  I create a collection of these data items which will be grouped by category, 
maintype and subtype

  var allDataItems:ArrayCollection;

  var currentDataItem = new MyDataItem();
  currentDataItem.Category = "Category A";
  currentDataItem.MainType = "Main Type A1";
  currentDataItem.SubType = "Sub Type A11";
  allDataItems.add(currentDataItem);
  // some more data items created and added to collection (this is all done 
through remoting)

  I need to basically achieve a collapsible layout as follows:

  [CATEGORY A]
    [MainType A1]
      [SubType A11]
      [SubType A12]
    [MainType A2]
      [SubType A21]
  [CATEGORY B]
    [MainType B1]
      [SubType B11]
    [MainType B2]
      [SubType B21]

  Where I can have any number of categories, main types and subtypes.

  I'm iterating through my collection of dataItems and generating 3 arrays of 
titles (one for categories, one for main types and one for subtypes). So at 
this point I have 3 string arrays of all the titles and one main collection of 
my original dataItems.

  I believe I can create the layout by essentially using an ItemRenderer within 
a List within an ItemRenderer within a List (etc etc :S)

  Where I'm completely stuck (possibly due to the time of day and lack of brain 
power) is how to manage the databinding of all of this.

  My most recent effort was to try to use another ArrayCollection which 
contained all 3 arrays and the itemData collection and bind that to the 
outer-most list. Each embedded list needs access to the main dataItem 
collection and uses it's "title group" to find the relevant subtitles.

  I'm pretty sure I'm barking up the wrong tree with all this and there is a 
better/simpler/more manageable approach, if anyone has got this far, still 
understands what I'm going on about AND has some suggestions on how to acheive 
this I'd be most grateful.

  Dan

  -- 
  http://danny-t.co.uk  

Reply via email to