And now that you have things bubbling, keep in mind that you might want to dispatch something other than “click” because the user can click on all kinds of things in a DataGrid and the click handler will get it.  For example, clicking on the scrollbar buttons, or some other part of the renderer will generate a click event.  Furthermore, unless GroupsEvent extends MouseEvent, you will not be able to watch for the click event from the DataGrid via MXML.  Thus the following will not work:

 

<mx:DataGrid click=”myClickHandler(event)” />

 

It will catch all clicks from anywhere, and if you send a GroupsEvent you will get a type mismatch.

 

The current recommended approach to interactive renderers is to use a unique event name, implement IDropInListItemRenderer and dispatch on the listData.owner.  In 2.0.1 we hope to fix the .owner property of all renderers so you can dispatch on them (it will be the DataGrid itself), and then you won’t have to worry about bubbling either.

 

-Alex

 


From: [email protected] [mailto:[email protected]] On Behalf Of Gordon Smith
Sent: Monday, October 30, 2006 9:13 AM
To: [email protected]
Subject: RE: [flexcomponents] Re: Datagrid ItemRenderer

 

> You can only set 'bubbles' in the constructor.

Sorry, I meant set it in your call to the Event constructor, where 'bubbles' is the second parameter, not set it with an assignment statement in your constructor. You'd call

 

    super(type, true);

 

in your constructor.

 

- Gordon

 


From: flexcomponents@yahoogroups.com [mailto:flexcompone[EMAIL PROTECTED]com] On Behalf Of Chad Callahan
Sent: Sunday, October 29, 2006 12:15 PM
To: flexcomponents@yahoogroups.com
Subject: RE: [flexcomponents] Re: Datagrid ItemRenderer

 

In my Event constructor I have:

 

  public function GroupsEvent(type:String,id:Number,isEnabled:Boolean=false){
   super(type);
   bubbles=true;
   this.isEnabled = isEnabled;
   this.id=id;
  }

 

When I compile, I get:

 

error 1059: Property is read-only.

 

Is there a way to set bubbles=true for a custom event?

 


From: flexcomponents@yahoogroups.com on behalf of Gordon Smith
Sent: Sat 10/28/2006 7:10 PM
To: flexcomponents@yahoogroups.com
Subject: RE: [flexcomponents] Re: Datagrid ItemRenderer

You can only set 'bubbles' in the constructor.

 

- Gordon

 


From: flexcomponents@yahoogroups.com [mailto:flexcompone[EMAIL PROTECTED]com] On Behalf Of Chad Callahan
Sent: Saturday, October 28, 2006 2:33 PM
To: flexcomponents@yahoogroups.com
Subject: RE: [flexcomponents] Re: Datagrid ItemRenderer

 

Thanks!  I successfully caught the event that my itemrenderer dispatched, however I need to add some data to the event.  In order to do this, I created a custom event.  The problem is that I can't set bubbles=true from within the custom event, I get a compiler error saying that bubbles is a read only property.  Is there a way to bypass this?

 

Chad

 


From: flexcomponents@yahoogroups.com on behalf of Michael Labriola
Sent: Sat 10/28/2006 12:31 PM
To: flexcomponents@yahoogroups.com
Subject: [flexcomponents] Re: Datagrid ItemRenderer


Chad,

When you dispatch the event, just be sure to set bubbles = true.

Then the event will bubble up through the dataGrid to the component
container. A couple of things on this, you will to be sure to notice
the difference between event.target and event.currentTarget.

They will be the renderer and the dataGrid. Make sure you are looking
at the right one for data.

--Mike

--- In flexcomponents@yahoogroups.com, "Chad Callahan" <[EMAIL PROTECTED]> wrote:
>
>
> I have an Icon in an ItemRenderer in my DataGrid that acts as a
button. Rather than having this button call a function, I would like
to have it dispatch a Click event. I can't figure out how to listen
for events from an ItemRenderer in the Component that is the owner of
the DataGrid. Has anyone done this?
>

__._,_.___


SPONSORED LINKS
Software development tool Application development software Development software
Development outsourcing software Embedded software development

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to