Ahh, yes...that would help...here is the construction for the ADG dataProvider.  I am making a web service call to our .NET backend to grab the data set.  This function is the result handler that builds the array for the ADG.

            private function groupedParticipantsResult(event:ResultEvent):void
            {
                groupedParticipantsArray = event.result as ArrayCollection;
               
                var gc:GroupingCollection = new GroupingCollection();
                gc.source = groupedParticipantsArray;
               
                var g:Grouping = new Grouping();
                gc.grouping = g;
                g.fields = [new GroupingField("Name")];
                gc.refresh();
                currentSubgroups.dataProvider = gc;


Tracy Spratt wrote:

What IS your dataProvider?

 

You mention “flat array”.  How are you getting a tree out of a flat array?

 

childIndex() is for XML.

 

Tracy

 


From: [EMAIL PROTECTED]ups.com [mailto:[EMAIL PROTECTED]ups.com] On Behalf Of Adrian Williams
Sent: Monday, August 18, 2008 12:15 PM
To: [EMAIL PROTECTED]ups.com
Subject: Re: [flexcoders] Re: Identifying row index relative to node vs. ADG - childIndex() fails.

 

Hi Amy,

    I've tried your suggestion and am having a problem...

    The childIndex() method is not available to my object...and I have tried it both with my drag event as well as my ADG with negative results (errors). 

    Here is the function that this lives in:
   
            private function dropHandler(event:DragEvent):void
            {
                var endIndex:int = event.currentTarget.selectedIndex;
                alert.info("Index is:" + endIndex);            
            .
            .
            .

    When I replace
        var endIndex:int = event.currentTarget.selectedIndex;
   
    with
       var endIndex:int = event.currentTarget.selectedItem.childIndex();

    I get --> TypeError: Error #1010: A term is undefined and has no properties.

    When I try accessing the actual ADG to attempt to get the position
      
                var endIndex:int = currentSubgroups.selectedItem.childIndex();

    I get the very same error. 

    Additionally, I've also tried:

                var endIndex:int = currentSubgroups.dataProvider.selectedItem.childIndex();

    which gets me --> ReferenceError: Error #1069: Property selectedItem not found on mx.collections.HierarchicalCollectionView and there is no default value.

    From what little I have been able to find on the net for documentation on the childIndex() method, it all seems to be using an XML data set.  Is that part of the problem here...that I am not using an XML dataset or am I mis-applying this method?

Thanks,
Adrian
   

Amy wrote:

--- In [EMAIL PROTECTED]ups.com, Adrian Williams <[EMAIL PROTECTED]>
wrote:
>
> Hi all,
>
> I have a challenge....
>
> I am using an ADG in tree mode on a flat array. Everything
looks
> great. One of the requirements is that whenever a user wants to
> rearrange the order of the rows under a node, I have to store that
index
> value (display order). I.E. The 1st node of the ADG is collapsed.
The
> 2nd node is expanded. The 5th row in the 2nd node gets dragged and
> dropped to the 3rd row of the same node. The 3rd row then becomes
the
> 4th and the 4th then becomes the 5th. The actual drag and drop
functions
> work beautifully. The problem comes into play when I try to
identify
> the begin index and the end index for the row that was manipulated.
>
> When I use:
>
> var beginIndex:int = event.currentTarget.selectedIndex;

selectedItem.childIndex();

HTH;

Amy

<<inline: ma_grp_160.gif>>

<<inline: transparent.gif>>

Reply via email to