--- In flexcoders@yahoogroups.com, shaun <[EMAIL PROTECTED]> wrote:
>
> 
> Djamshed wrote:
> > When you open children in AdvancedDataGrid which uses Hierarchical
> > data, rowIndex in selectedCells does not refer to the ADG's
> > dataprovider index.
> > 
> > Here is the example: http://djamshed.googlepages.com/grid.html
> > Source is here: http://djamshed.googlepages.com/Grid.mxml.html
> > 
> > Open a child node and DOUBLE CLICK on any cell of a child, 
rowIndex
> > seems correct (in terms of reflecting the row number), but this
> > rowIndex definitely does NOT REFER to the index in dataprovider. 
Is
> > there any way to get the selected data?
> > 
> > PS: ADG's variable named "firstCellSelectionData" seems like 
keeping
> > the correct value, but it is private. Looked at the source of 
ADG, it
> > says that everything it keeps is found in selectedCells, so the 
story
> > begins from scratch.
> > 
> 
> There is a lot of good information in the help/API docs section of 
Flex 
> Builder.
> If you have a quick glance through the API docs you'll see the 
following 
> two properties, selectedItem and selectedItems which might be 
> appropriate for your situation.
> 
> 
> --------------------------------------------------------------
> selectedItem  property        
> selectedItem:Object  [read-write]
> A reference to the selected item in the data provider.
> 
> The default value is null.
> 
> This property can be used as the source for data binding.
> 
> 
> Implementation
>      public function get selectedItem():Object
>      public function set selectedItem(value:Object):void
> 
> --------------------------------------------------------------
> 
> selectedItems property        
> selectedItems:Array  [read-write]
> An Array of references to the selected items in the data provider. 
The 
> items are in the reverse order that the user selected the items.
> 
> The default value is [ ].
> 
> This property can be used as the source for data binding.
> 
> 
> Implementation
>      public function get selectedItems():Array
>      public function set selectedItems(value:Array):void

In addition, you can get information on the parent like this:

http://flexdiary.blogspot.com/2008/07/musings-on-advanceddatagrid-
part-5_03.html

This is some code that illustrates the principle:

private function onMenuItemClick(e:ListEvent):void{
                                                if 
(e.itemRenderer.data is TaskUID){
                                //broadcast task to Authorware
                                var 
dp:HierarchicalCollectionView=e.currentTarget.dataProvider as 
HierarchicalCollectionView;
                                trace(dp.getParentItem
(e.currentTarget.selectedItem));
                        }
}

Reply via email to