I've used 1) and 2) before and both works fine for me.
1) is a bit tricky some times as you have to take care when to access
listData because it is not necessarily there during the whole lifecycle
of your item renderer.
2) is neat, especially when you use parameterized ItemRenderers on those
columns because then your itemRenderer does not need to be hardwired to
a formatter function in the parent document scope (or whereever you
place it)
i.e.
<mx:DataGridColumn
itemRenderer="{new CustomClassFactory(YourItemRenderer,
{formatFunction: anotherObjectsomeFunction}}"
/>
YourItemRenderer then just needs a public var formatFunction:Function
and you're all set. CustomClassFactory itself is a subclass of
mx.core.ClassFactory - for more info on this technique see Antatole's
blog entry http://flexblog.faratasystems.com/?p=91
Dirk.
> -----Original Message-----
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of Steve Hagenlock
> Sent: Thursday, December 21, 2006 2:22 AM
> To: [email protected]
> Subject: [flexcoders] strategy for Composite component as
> itemRenderer in DataGrid or List
>
> Hello,
>
> I'm trying to create a strategy for creating a summary/detail
> editing interface using either mx.List or mx.DataGrid (with
> one column).
>
> I've created a composite component, which uses two States, a
> summary (with a text label and a checkbox) and a detail
> (based on summary with some other controls).
>
> That dataProvider I plan on using is an ArrayCollection which
> is a collection of Object instances of various classes, where
> each class implements a toString() function which returns an
> XML formatted String (of the String class). I point that
> last bit out because the toString() function is getting
> called and the results are being returned, rather than the
> instance reference itself in some of the test cases I've done.
>
> Incidentally, I can use this dataProvider model with a basic
> DataGrid without issues.
>
> I've chosen to attempt to do this with a DataGrid or List, as
> opposed to a VBox with a repeater because of the efficiences
> of the pattern the DataGrid/List are based on as well as
> gaining the drag/drop features.
>
> I'm fine with doing the binding between the properties in the
> objects in the ArrayCollection to the controls in the
> composite component, I'm having difficulty gaining a
> reference to the ArrayCollection objects as objects.
>
> Briefly, I've explored:
> 1)
> implements="mx.controls.listClasses.IDropInListItemRenderer"
> on the composite component coupled with 'get listData()' and
> 'set listData()'
> functions.
>
> 2) Using a custom formatter function which returns a
> reference to the object (applied in the datagrid column) or list.
>
> And various tweaks on the above concepts...
>
> If anyone has done this sort of thing, could you point me in
> the right direction? It would be much appreciated.
>
> -Steve
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
>
>
>
>