I'm still not sure what you want.  If you click into a place on the
ListBaseContentHolder where there are no renderers because you don't
have enough data in your DP, then yeah, it'll return null.  If you want
to estimate what index it would be, you can use rowHeight and rowInfo to
guess at it.

 

If a header gets clicked on, you can look at event.target, figure out if
it is a renderer or child of a renderer, make sure it is a header
renderer and look at the dataGridColumn in its .data property.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Cato Paus
Sent: Tuesday, April 22, 2008 11:20 AM
To: [email protected]
Subject: [flexcoders] Re: Overriding the mouseClickHandler in DataGrid

 

Hi Alex thanks for reply, the r = mouseEventToItemRenderer(event); is 
returning null if I hit the header (DataGridHeader), and the 
ListBaseContentHolder. Can I get a index from somewhere, I have try 
to get the index and it seams like it have a delay, I'm getting the 
pri value, I have to click it two times before the index changes.

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> You want to know if the header got clicked? Try
> 
> 
> 
> If (r.data is DataGridColumn)
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>

[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Cato Paus
> Sent: Tuesday, April 22, 2008 6:23 AM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Overriding the mouseClickHandler in DataGrid
> 
> 
> 
> Hi Alex, do you have a better suggestion?
> 
> override protected function mouseClickHandler(event:MouseEvent):void
> {
> var pattern:RegExp = /DataGridHeader/;
> var test:String = String(event.target);
> if(pattern.test(test)){
> var r:IListItemRenderer;
> r = mouseEventToItemRenderer(event);
> if(r)
> {
> super.mouseClickHandler(event);
> }
> else
> {
> clearSelected(true);
> dispatchEvent(new ListEvent(ListEvent.CHANGE));
> event.stopImmediatePropagation();
> }
> }
> }
>

 

Reply via email to