Search code examples
apache-flexitemeditor

Flex: ItemEditor losing focus!


Here's an image of what my problem is: I am using a combo-box as a Datagrid ItemEditor (Not just Renderer, my Renderer is a Label, double clicking on a cell makes the combo-box visible, as is the case with all item editors)

Now, selecting one of the entries in the combo-box is no problem. But my problem is only when i select the "Fruit" , which in turn pops open another layer called "Select Fruit" dialog

Questions:

How do i keep item editor, while the focus is on the layer; right now as soon as i click on the fruit , my handler popsup the "Select Fruit" dialog and the focus is on the layer. Once the focus goes out of the editor, the ItemEditor goes away and ItemRenderer label comes back.

I want to keep the ItemEditor alive! where do I hook up interms of events like begin/end ItemEdit etc?

Flex: Item editor, losing focus!


Solution

  • You can keep your itemEditor alive by listening for DataGridEvent.ITEM_EDIT_END. Then you have a lot more control to do what you want. Some FYI from my blog:

    DataGridEvent.ITEM_EDIT_END - Dispatched when focus is removed from the cell - List-based control’s default event listener will

    1) use the .editorDataFrield property to deterine the property of the item editor to store the edited data; In a default TextInput control’s item editor, the “text” property would contain the new data.

    2) Invoke destoryItemEditor() depending on the reason of the event

    • You can interrupt the default List-based control’s default event listener by using event.preventDefault() to

    a) Modify the data returned from the item editor

    b) Examine/Validate the data entered into the item editor; If the data is incorrect, you can halt Flex passing the data back from the item editor into the list-based control

    http://knowledge.lapasa.net/?p=153