Hello all

I'd really appreciate your help on this.
I have a itemEditor in my datagrid (see attached code).. this is a drag&drop 
text input... I drag words inside and it concatenates them to a comma separated 
string...
I've embedded it in the grid like that:
<mx:DataGridColumn headerText="Prevent ctx" dataField="@prevent_ctxs" 
rendererIsEditor="true" width="200"
itemRenderer="CtxTI" editable="true"/>

The problem is that the grid does not sense the itemBegin/itemEnd events when I 
drag things inside..
and therefore does not activate the editor/automatically "pull" the data of the 
itemEditor and puts it into the grid..
 
Can anyone figure a way to correct/around this?

Thanks in advance
Afik Gal 

<==============  CtxTI.mxml ===>
<?xml version="1.0" encoding="utf-8"?>
<mx:TextInput xmlns:mx="http://www.adobe.com/2006/mxml";
                      dragDrop="dragDrop(event)" dragEnter="dragAccept(event)">
<mx:Script>
        <![CDATA[

        import mx.events.DragEvent;
        import mx.managers.DragManager;
        import mx.controls.listClasses.ListData;
        import mx.controls.dataGridClasses.DataGridListData;
        import mx.controls.listClasses.BaseListData;
 
    override public function set data(value:Object):void
    {
        super.data=value;
        var attrib:String= 
DataGridListData(listData).dataField.substr(1,-1+DataGridListData(listData).dataField.length);
        var input:String;
        if (value) input=XML(value).attribute(attrib)[0].toString(); 
                if (input!="")  this.text=input;
    }
                
                
         private function dragAccept(event:DragEvent):void
        {
                var dropTarget:TextInput = event.currentTarget as TextInput;
                DragManager.acceptDragDrop(dropTarget);
        }               
    private function dragDrop(event:DragEvent):void
    { 
        if (!event.dragSource.hasFormat("treeItems")) return;
        var arr:Array = event.dragSource.dataForFormat("treeItems") as Array;
                var str:String = XML(arr[0])....@label.tostring();
                if ((this.text.substr(-1)!=",") && (this.text.length>0)) 
this.text+=",";
                this.text+=str+",";
        }
        ]]>
</mx:Script>
</mx:TextInput>


Reply via email to