Re: [flexcoders] Re: What event to catch

2007-12-31 Thread jeff
On Sat, Dec 29, 2007 at 02:29:18PM -, ben.clinkinbeard wrote:

 An example of this approach can be seen here:
 http://www.returnundefined.com/files/CheckBoxRenderers/srcview/index.html
 That is using a click event but the principle is identical.

In this example, why is the event listener added to the Application instead of 
to the CenteredCheckBoxHeaderRenderer?  Then you wouldn't have to 
check the event target.


-Jeff



[flexcoders] Re: What event to catch

2007-12-31 Thread ben.clinkinbeard
You certainly could put the listener there but that would cause a
number of disadvantages. It would make for a less clear separation of
duties because your renderer class would then contain logic as well.
In the context of a large application you definitely would not want to
be setting data and performing similar actions in a multitude of
different places like that either as it would make maintenance and
troubleshooting a nightmare. It would also make your renderer far less
generic/reusable.

In a real application the listener wouldn't be at the Application root
but in an appropriately high-level view, such as a screen/page/form.

HTH,
Ben



--- In flexcoders@yahoogroups.com, [EMAIL PROTECTED] wrote:

 On Sat, Dec 29, 2007 at 02:29:18PM -, ben.clinkinbeard wrote:
 
  An example of this approach can be seen here:
 
http://www.returnundefined.com/files/CheckBoxRenderers/srcview/index.html
  That is using a click event but the principle is identical.
 
 In this example, why is the event listener added to the Application
instead of to the CenteredCheckBoxHeaderRenderer?  Then you wouldn't
have to 
 check the event target.
 
 
 -Jeff





[flexcoders] Re: What event to catch

2007-12-29 Thread ben.clinkinbeard
Events that bubble don't need to be passed up. That is what bubbling
is: an event that bubbles will move from the component that dispatches
it to that component's parent, and then to that component's parent,
and so on and so on all the way up to the root of your app. So you can
listen for the event in the same component that houses your DataGrid
and it will automatically catch it. One thing to note is that you'll
probably want to check event.target inside the handler because you'll
be catching all events of the given type.

An example of this approach can be seen here:
http://www.returnundefined.com/files/CheckBoxRenderers/srcview/index.html
That is using a click event but the principle is identical.

HTH,
Ben



--- In flexcoders@yahoogroups.com, mark goldin [EMAIL PROTECTED]
wrote:

 Is it possible that you could have pointed me to a sample or
something that would explain in greater detail how to pass an event
from the inside of DataGrid's cell up to the DataGrid level?

   Thanks much.
 
 Alex Harui [EMAIL PROTECTED] wrote:
   If you read the docs, you'll see that it bubbles
   
   
 -
   
   From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of mark goldin
 Sent: Thursday, December 27, 2007 6:35 PM
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] What event to catch
 
   
 Is there an applicable event at the Gird level?
 
 Alex Harui [EMAIL PROTECTED] wrote: 
 focusOut
 
   
 -
   
 From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of markgoldin_2000
 Sent: Thursday, December 27, 2007 6:18 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] What event to catch
 
 
   My Grids has an ability to add a new record when a user
presses down 
 key being at the last record.
 But I also want to remove that record if he navigates away from that 
 record while nothig was ent! ered into any cell. What even do I
catch to 
 remove this re! cord?
 Also when I add a new record I want to highlight it and have a mouse 
 pointer in one of the cells. Is that possible to do?
 
 Thanks for help.