I'm using a popup item editor in a datagrid. I based it on
http://blog.flexmonkeypatches.com/2007/12/12/datagrid-popup-as-itemeditor/
 . But instead of using the custom Text component as the itemRenderer,
I used a custom TextInput as itemEditor and Datagridcolumn is
editable.  I've also added a KEY_DOWN listener in the custom
itemEditor, wherein the user can use a key (i.e. F1) to call the popup
(which is a search/lookup).  

The reason for this is that the user can input data via typing it
directly on the TextInput or via the popup upon pressing F1.

Editing cell contents is working well via typing directly or via the
popup lookup.  I can validate directly typed input using via the
itemEditEnd.

My problem is, I can't think of a way to validate the inputs via the
popup lookup. Is there a way to call a function in the main
application before updating the datagrid's dataprovider?

In the custom item editor, the function below is being called after
popup returns the selected value:

public function updateDP(str:String):void{
   //need to validate str before updating the dataprovider

   var myDG:DataGrid=this.owner as DataGrid;
   this.data[_listData.dataField]=str;
   myDG.dataProvider.itemUpdated(data);
}

or is there a better way to validate stuffs in the datagrid?
Currently, I only have to check for duplicates and allowed values. 

Thanks in advance!




Reply via email to