I haven't tried this but the Tree implementation changed significantly
for the beta so I'd recommend waiting for it to test this out again if
you can wait a little while longer.

Matt

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of sourcecoderia
Sent: Wednesday, January 25, 2006 9:09 AM
To: [email protected]
Subject: [flexcoders] Re: Could someone please confirm this (Tree,
Dragdrop, e4x with FLEX 2.0)?

First thanks for responding,

I assume this is a flex 1.5 example as no dragevent is in the call to 
dropparent etc..

I'm using flex 2.0 alpha, and this is the code for the drop event.
The below code should work but does not. The item dropped is always 
inserted at the bottom or the parent. In the underlying data source 
the dropped node is in the correct location. This only happens when 
using a xml, or e4x result for binding to the tree component. I need 
to get this working for e4x results. So; it seems that the data 
source is updated correctly but the tree control does not reflect the 
changes.

Does this make sense ?


private function handleDragDrop(event:DragEvent)
{
   event.target.hideDropFeedback(event);
   var items:Object = event.dragSource.dataForFormat("treeItems");  
   var dropLoc:int = event.currentTarget.getDropLocation(event)
   var dropparent:Object = event.currentTarget.getDropParent(event); 
   
   for each (var item:Object in items){
      dropparent.addTreeNodeAt(dropLoc,item);
   }
}

Thanks again for your help.

Jason Hawryluk


--- In [email protected], "Anatole Tartakovsky" 
<[EMAIL PROTECTED]> wrote:
>
> If I understand your question correctly, you need to find real drop 
position to add tree element. Most common issue is that people use 
getDropLocation and do not look at getDropParent. Something like this 
usually solves the issue:
> function getRealDropLocation() {
>  dropLoc = tv_1.getDropLocation();
>  dropParent = tv_1.getDropParent();
> // Logger.trace(dropLoc + ":" + dropParent);
> // Logger.trace("!!!" + dropLoc + ":" + tv_1.getItemAt(0));
>  var i;
>  for ( i = 0; i < tv_1.rowCount;  i++) 
>   if ( dropParent == tv_1.getItemAt(i) ) {
>    dropLoc+=i;
>    break;
>   }
> }
> Sorry if I misunderstand your question - posting code would be a 
way to see the problem if it is different from the above.
> HTH,
> Anatole Tartakovsky
>   ----- Original Message ----- 
>   From: sourcecoderia 
>   To: [email protected] 
>   Sent: Wednesday, January 25, 2006 8:23 AM
>   Subject: [flexcoders] Could someone please confirm this (Tree, 
Dragdrop, e4x with FLEX 2.0)?
> 
> 
>   Has anyone used a tree control and e4x data returned from web 
service, 
>   and implemented drag and drop node positioning successfully? 
> 
>   Can anyone confirm there is a bug ?
> 
>   The control won't place the dropped node in the right place. It 
always 
>   appears at the bottom of the parent node. However in the data 
source 
>   xml, the node is in the correct place. It seems the tree is not 
>   refreshing properly in relation to data source changes.
> 
>   If anyone has got this working properly can that person please 
share 
>   the secret.?
> 
>   I feel that I am wasting my time trying different variations with 
no 
>   success.
> 
>   Thanks
> 
>   Jason Hawryluk
> 
> 
> 
> 
> 
> 
> 
> 
>   --
>   Flexcoders Mailing List
>   FAQ: 
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>   Search Archives: http://www.mail-archive.com/flexcoders%
40yahoogroups.com 
> 
> 
> 
> --------------------------------------------------------------------
----------
>   YAHOO! GROUPS LINKS 
> 
>     a..  Visit your group "flexcoders" on the web.
>       
>     b..  To unsubscribe from this group, send an email to:
>      [EMAIL PROTECTED]
>       
>     c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms 
of Service. 
> 
> 
> --------------------------------------------------------------------
----------
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to