PDA

View Full Version : [AS3] DataGrid ItemEditor Focus Issue


rookpsu
07-17-2008, 09:47 PM
In short...

I have a datagrid, 5 columns. In the first column is my itemEditor - a skinned ComboBox resting in a VBox.

What I want to do is have the ComboBox arrow visible only for active (highlighted row).

Right now it only appears when you click on the itemRenderer cell itself.

I can catch the mouseOver event of the dataGrid - and the rowIndex - but from there i'm stumped. No events (that I can tell) are firing in my ItemEditor class so I can't grab it there.

There's no DataGridRow class. There doesn't seem to be a cell class either.

In its simplist form....If a user rolls over row4, how do I set the focus to col1, row4.


ANY help would be appreciated.

Sleeve
07-18-2008, 03:40 AM
Your itemEditor is instantiated as needed and does not persist. The dataGrid re-uses the itemEditor instances to speed up performance but they are not persistent. They are added to the display list as needed and removed when not needed. That's why you are probably able to pick up events on your editor only when the row is selected.

If your comboBox is inside your custom editor, You won't be able to show it unless you override the native behavior of the datagrid. What I would do is create a custom cell renderer that can act as an itemEditor as well. This way you can hook into mouse events that show the comboBox arrow on mouseOver yet maintain editing functionality when the user clicks on a cell or row. Does this make sense?