I'm glad you found an easy way to get the functionality you wanted.

According to the docs, mouseEnabled defaults to true. I wonder why the ADGGIR 
constructor sets it to false? Also, why don't the docs reflect this?

I just wanted to say that if you still wanted the functionality from 
AdvancedDataGridGroupItemRenderer and you wanted extra functionality, you can 
extend AdvancedDataGridGroupItemRenderer for your renderer. Best of both worlds 
;-)



--- In [email protected], Pan Troglodytes <chimpathe...@...> wrote:
>
> Well, the main reason I wouldn't want to write my own itemRenderer is that
> AdvancedDataGridGroupItemRenderer does a lot of stuff I wouldn't want to
> have to reinvent.  It also interacts with stuff like iconFunction that would
> be annoying to re-implement.  Plus, there's the fact that there's a high
> likelihood that what I wrote would be much less efficient.
> 
> But good news!  I found a simple way to achieve what I want:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <Application
>   xmlns="http://www.adobe.com/2006/mxml";
>   >
>   <Script>
>     <![CDATA[
>       // put any icon you want in the embed below, doesn't matter
>       [Bindable] [Embed(source="imageA.png")] private var imgClass:Class;
> 
>       private function geticon(item:Object):Class
>       {
>         return imgClass;
>       }
>     ]]>
>   </Script>
>   <AdvancedDataGrid iconFunction="geticon" itemClick="trace('itemclick')"
> click="trace('gridclick')">
>     <groupItemRenderer>
>       <Component>
>         <AdvancedDataGridGroupItemRenderer mouseEnabled="true"/>
>       </Component>
>     </groupItemRenderer>
>     <dataProvider>
>       <HierarchicalData childrenField="subitems" source="{[{label:'test'},
> {label:'test2'}]}"/>
>     </dataProvider>
>     <columns>
>       <AdvancedDataGridColumn dataField="label"/>
>      </columns>
>   </AdvancedDataGrid>
> </Application>
> 
> The key was setting mouseEnabled=true.  It is set to false in the
> constructor for ADGGIR.  I'm not sure why, and I am a little worried that I
> may be messing up something important.  So far I haven't noticed any odd
> behavior.  But if anyone knows a good reason WHY mouseEnabled is set this
> way, please followup.
> 
> 
> On Mon, Jun 29, 2009 at 11:13 AM, valdhor <valdhorli...@...>wrote:
> 
> >
> >
> > Why not just use an itemRenderer?
> >
> > AFAIK. you can't capture a mouse event on a Class object as it does not
> > implement iEventDispatcher. I suppose you could extend Class and implement
> > iEventDispatcher but I have never tried it.
> >
> >
> > --- In [email protected] <flexcoders%40yahoogroups.com>, Pan
> > Troglodytes <chimpathetic@> wrote:
> > >
> > > No ideas on how to do this at all?
> > >
> > > On Tue, Jun 9, 2009 at 4:13 PM, Pan Troglodytes <chimpathetic@>wrote:
> >
> > >
> > > > I've got a bit of a problem and haven't been able to figure it out.
> > When
> > > > using hierarchical views with ADG, I find that the icon can't be
> > clicked on
> > > > to select the row. I can't figure out how to capture a click on the
> > icon at
> > > > all.
> > > >
> > > > <?xml version="1.0" encoding="utf-8"?>
> > > > <Application
> > > > xmlns="http://www.adobe.com/2006/mxml";
> > > > >
> > > > <Script>
> > > > <![CDATA[
> > > > // put any icon you want in the embed below, doesn't matter
> > > > [Bindable] [Embed(source="imageA.png")] private var imgClass:Class;
> > > >
> > > > private function geticon(item:Object):Class
> > > > {
> > > > return imgClass;
> > > > }
> > > > ]]>
> > > > </Script>
> > > > <AdvancedDataGrid iconFunction="geticon" itemClick="trace('itemclick')"
> > > > click="trace('gridclick')">
> > > > <dataProvider>
> > > > <HierarchicalData childrenField="subitems" source="{[{label:'test'},
> > > > {label:'test2'}]}"/>
> > > > </dataProvider>
> > > > <columns>
> > > > <AdvancedDataGridColumn dataField="label"/>
> > > > </columns>
> > > > </AdvancedDataGrid>
> > > > </Application>
> > > >
> > > > If you click anywhere but the icon, the gridclick and itemclick events
> > both
> > > > fire. But if you click on the icon, you get only the gridclick. And the
> > > > gridclick event doesn't get anything useful for target/currentTarget,
> > as far
> > > > as I can tell.
> > > >
> > > > The main thing I really want to do is have clicking on the icon select
> > the
> > > > row, just like clicking anywhere else will do. Tangentially, it would
> > be
> > > > nice to know how to capture the event in case I wanted to do something
> > > > different with clicking on the icon.
> > > >
> > > > --
> > > > Jason
> > > >
> > >
> > >
> > >
> > > --
> > > Jason
> > >
> >
> >  
> >
> 
> 
> 
> -- 
> Jason
>


Reply via email to