The ADG will create the cursor, you don't do it yourself unless you also
need to walk the collection.  Your largeObject is really an array and is
not hierarchical so creating the proper IHD implementation will be
trickier but doable I think.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of joshuajnoble
Sent: Thursday, January 10, 2008 7:16 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: HierarchicalCollectionViewCursor

 

So I have this:

private function init():void {

var largeObject:Object = 
[{ id:"1", name:"Misc", type:"parent", parentTask:"0"}, 
{id:"2", name:"Clean the kitchen", type:"parent", parentTask:"0"}, 
{id:"3", name:"Pay the bills", type:"parent", parentTask:"0"},
{id:"4", name:"Paint the shed", type:"parent", parentTask:"1"}, 
{id:"5", name:"Get ready for party", type:"parent",
parentTask:"1"},
{id:"6", name:"Do the dishes", type:"child", parentTask:"2"},
{id:"7", name:"Take out trash", type:"child", parentTask:"2"},
{id:"8", name:"Gas Bill", type:"child", parentTask:"3"},
{id:"9", name:"Registration", type:"child", parentTask:"3"},
{id:"10", name:"Fix the car", type:"parent", parentTask:"0"},
{id:"11", name:"New tires", type:"child", parentTask:"10"},
{id:"12", name:"Emissions test", type:"child", parentTask:"10"},
{id:"13", name:"Get new paint", type:"child", parentTask:"4"},
{id:"14", name:"Buy brushes", type:"child", parentTask:"4"},
{id:"15", name:"Buy Drinks", type:"child", parentTask:"5"},
{id:"16", name:"clean living room", type:"child", parentTask:"5"},
{id:"16", name:"finish invitations", type:"child",
parentTask:"5"}];

/* create a new class that implements the IHierarchicalData
interface */
var dataObj:ObjectHierarchicalData = new
ObjectHierarchicalData(largeObject);

dg.dataProvider = dataObj;

hd = new HierarchicalCollectionView(dataObj);
cursor = new HierarchicalCollectionViewCursor(hd, hd, dataObj);
}

The first arg to the Cursor needs to be the collection, the next
something that implements ICollectionView (should this be something
different? ) and the third the IHierarchicalData obj that provides the
info about parent/child relationships etc. Am I thinking about this
incorrectly?

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> IHierarchicalData describes the hierarchy of the data in the model.
How
> to get its children, determine if there is a branch, etc.
> 
> 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of joshuajnoble
> Sent: Tuesday, January 08, 2008 2:19 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] HierarchicalCollectionViewCursor
> 
> 
> 
> Can anyone shed any light on the constructor of the
> HierarchicalCollectionViewCursor, the signature is: 
> 
> public function
>
HierarchicalCollectionViewCursor(collection:HierarchicalCollectionView,
> model:ICollectionView, hierarchicalData:IHierarchicalData) 
> and the explanation in the docs is:
> 
> collection:HierarchicalCollectionView - The
> HierarchicalCollectionView instance referenced by this cursor. 
> 
> model:ICollectionView - The source data collection. 
> 
> hierarchicalData:IHierarchicalData - The data used to created the
> HierarchicalCollectionView instance. 
> 
> which seems a little unclear to me. What is the relationship between
> model and the hierarchicalData parameters there? I can't seem to find
> any info.
> 
> Also, I've created a HierarchicalCollectionViewCursor which can
> traverse the top level nodes, but even after opening a secondary node,
> I cannot get the cursor to traverse the lower nodes. Any thoughts or
> comments?
>

 

Reply via email to