Solved

Adding event listener to datagrid column

Posted on 2011-09-26
6
377 Views
Last Modified: 2012-05-12
hi guys

I want to add an event listener to a datagrid column but it doesnt seem to work
My code:

public class TradeGrid extends VBox implements IComponent
{
private function buildColumnModel(complexheaders:Object,fields:Object):void{
//This works
dataGrid.addEventListener(flash.events.KeyboardEvent.KEY_UP,populate);// works fine
}

private function createColumn(columnIndex:int,fieldObject:Object):AdvancedDataGridColumn{
var column:AdvancedDataGridColumn = new AdvancedDataGridColumn();
column.addEventListener(flash.events.KeyboardEvent.KEY_UP,populate);// Does not work
return column;
}

private function populate(event: flash.events.KeyboardEvent) : void {      
PopUpManager.addPopUp(LookUp.dataGrid, this, false); //popup the grid            
         }
}      

Any ideas?

Thanks
0
Comment
Question by:royjayd
  • 3
  • 2
6 Comments
 
LVL 11

Accepted Solution

by:
petiex earned 400 total points
ID: 36602131
DataGridColumn just doesn't dispatch any Keyboard events. In fact, the only events it dispatches are flash.events.Event.ACTIVATE and flash.events.Event.DEACTIVATE, which it inherits from EventDispatcher. The reason that DataGrid does dispatch Keyboard events is because it inherits them from InteractiveObject.

I haven't tested this, but it might be that column.itemRenderer.addEventListener(KeyboardEvent.KEY_UP,populate); might work?
0
 

Author Comment

by:royjayd
ID: 36602151
thx for responce
>>column.itemRenderer.addEventListener(KeyboardEvent.KEY_UP,populate);

says access of undefined property addEventListener

 
0
 

Author Comment

by:royjayd
ID: 36672950
Experts,

Any idea if this is possible?

Thx.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 29

Assisted Solution

by:dgofman
dgofman earned 100 total points
ID: 36712628
Why you cannot add ebent listener inside ItemRenderer what the problem?
0
 
LVL 29

Expert Comment

by:dgofman
ID: 36712644
And why you call your class as TradeGrid and extended from VBox instead DataGird?

public class TradeGrid extends VBox
0
 
LVL 29

Expert Comment

by:dgofman
ID: 36712657
I need full code to understad what are you doing????
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now