I'm facing some problems with the spark architecture to create a custom item editor (inherited from GridItemEditor). The component I'm creating has a TextInput and the user will fill it to search something on the server. So, when the user fills the TextInput and press Enter or Tab, I need to make a request to the server using a RemoteObject and wait the request complete to close the itemEditor (the dataprovider will be commited with the information received from the server).
I can handle this situation when the user press Enter or Tab. Actually, this is what I have done:
1) The user fills the TextInput and hit Enter.
2) I have overwritten the save method of GridItemEditor and it calls a method to make a request to my server if appropriate. My save method returns false indicating the data was not saved yet.
3) When my data is received from server, I dispatch a fake KEY_FOCUS_CHANGE event and the process start again, but this time I don't need to make a request to the server anymore and everything works fine.
My problem is when the user fills the TextInput and clicks out of the editor. I have seen in the DataGridEditor source code that it register a listener (sandBoxRoot_mouseDownHandler) to the MOUSE_DOWN event and if it receives this event, it tries to save the editor. If it can't it cancels and my itemEditor is destroyed. I don't want this behaviour. If the user clicks outside my component, I need to make a request and wait until the data is received to destroy the item editor (as I have done before).
The problem is the methods in the DataGridEditor are private, I can't override them. So I cannot unregister sandBoxRoot_mouseDownHandler for example. And I can't just cancel the MOUSE_DOWN event because it is used by other components.
Does some have some done anything similar before? I believe this always will happen if you mix item editors with RemoteObjects. My question can be resumed as: how can I prevent and item editor to be destroyed when the user clicks out of it? With mx itemeditor I could do this using itemEditEnd event.
Thansk in advance!