Yes, leave off renderIseditor="true".

 

Your renderer will know which item it is currently associated with, since
that reference gets passed into the renderer any time the underlying data
changes in the set data() function.  Further, if the renderer implements the
IDropInListItemrrenderer interface, you will als have access to the listData
and thus dataProvider, should you need to get the itemIndex using
getItemIndex.

 

  _____  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Gal Afik
Sent: Saturday, March 07, 2009 12:48 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: drag&drop inside itemEditor in dataGrid...a tricky
question

 

Hmm...

Thanks for the response...nice idea... but how do I access the right row in
the dataprovider XMLListCollection? (rowIndex?)
and if I choose this approach I simply turn the editor to renderer?

Thanks
Afik

--- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
"Tracy Spratt" <tspr...@...> wrote:
>
> For a renderer of that complexity, I would not use the DGs native editable
> process, but would handle the dataProvider item updates within the
renderer
> itself.
> 
> 
> 
> Tracy
> 
> 
> 
> _____ 
> 
> From: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com
[mailto:flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com]
On
> Behalf Of Gal Afik
> Sent: Saturday, March 07, 2009 10:42 AM
> To: flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com
> Subject: [flexcoders] drag&drop inside itemEditor in dataGrid...a tricky
> question
> 
> 
> 
> 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. <http://www.adobe.
<http://www.adobe.com/2006/mxml> com/2006/mxml>
> 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