Just want to explain here how I solved this. I set the groupItemRenderer of
the ADG to render a customItemRenderer that I created. I had to implement
the expand/collapse functionality that the AdvancedDataGridGroupItemRenderer
takes care of by default. Rather than extend this class, the custom
component implements mx.controls.listClasses.IDropInListItemRenderer which
will then expose the getter/setters of the listData. The listData will
provide a reference to the ADG which then can dispatch the ITEM_OPENING
events. This custom component must also use the mx_internal namespace to be
able to dispatch the event.
Code:
public function set listData( value : BaseListData ) : void
{
_listData = AdvancedDataGridListData(value);
_listOwner = AdvancedDataGrid(_listData.owner);
}
public function get listData():BaseListData
{
return _listData;
}
private function expand(event:Event) : void
{
event.stopPropagation();
var open:Boolean = _listData.open;
_listData.open = !open;
var evt:AdvancedDataGridEvent = new
AdvancedDataGridEvent(AdvancedDataGridEvent.ITEM_OPENING,true, false,
_listData.columnIndex, null, _listData.rowIndex);
_listOwner.dispatchEvent(evt);
_listOwner.dispatchAdvancedDataGridEvent(AdvancedDataGridEvent.ITEM_OPENING,
_listData.item, this, event, !open, true, true)
}
Tom McNeer wrote:
>
> What do you actually intend to render? The ADG itself has attributes for
> GroupItemRenderer, GroupIconFunction and GroupLabelFunction. One of those
> ought to handle what you need.
>
> On Wed, Oct 28, 2009 at 3:54 PM, powers <[email protected]> wrote:
>
>>
>>
>>
>> I have an advanced data grid with a dataprovider with a grouped
>> collection.
>>
>> The default of the ADG is to display a folder icon, along with whatever
>> text
>> is contained in the datafield, as the parent element. All the children
>> are
>> displayed with the paper icon and the text that is displayed in the
>> datafield. I want to display a custom component as the parent AND another
>> custom component as the child. Setting the itemRenderer property on the
>> column will solve my problem for displaying a custom component for the
>> child. How can I use a itemRenderer for the parent?
>> --
>> View this message in context:
>> http://www.nabble.com/AdvancedDataGrid-Grouping%3A-itemRenderer-for-parent-tp26101136p26101136.html
>> Sent from the FlexCoders mailing list archive at Nabble.com.
>>
>>
>>
>
>
>
> --
> Thanks,
>
> Tom
>
> Tom McNeer
> MediumCool
> http://www.mediumcool.com
> 1735 Johnson Road NE
> Atlanta, GA 30306
> 404.589.0560
>
>
--
View this message in context:
http://www.nabble.com/AdvancedDataGrid-Grouping%3A-itemRenderer-for-parent-tp26101136p26116538.html
Sent from the FlexCoders mailing list archive at Nabble.com.