Re: [flexcoders] Tree is not correctly updated when dragging and dropping item twice when using XML data provider

2009-01-07 Thread Sergey Kovalyov
Thanks, Manish!

I will try this.

Sergey.

On Tue, Jan 6, 2009 at 6:58 PM, Manish Jethani wrote:

>On Tue, Jan 6, 2009 at 10:27 PM, Manish Jethani
> > wrote:
>
> > function doWorkaround() {
> > var e = new CollectionEvent("collectionChange");
> > e.kind = "update";
>
> Hey, I meant:
>
> e.kind = "reset";
>
> That'll refresh everything.
>
> > myXMLListCollection.dispatchEvent(e);
> > }
>
> Manish
>
> 
>


Re: [flexcoders] Tree is not correctly updated when dragging and dropping item twice when using XML data provider

2009-01-06 Thread Manish Jethani
On Tue, Jan 6, 2009 at 10:27 PM, Manish Jethani
 wrote:

>  function doWorkaround() {
>   var e = new CollectionEvent("collectionChange");
>   e.kind = "update";

Hey, I meant:

 e.kind = "reset";

That'll refresh everything.

>   myXMLListCollection.dispatchEvent(e);
>  }

Manish


Re: [flexcoders] Tree is not correctly updated when dragging and dropping item twice when using XML data provider

2009-01-06 Thread Manish Jethani
On Tue, Dec 30, 2008 at 7:52 PM, Sergey Kovalyov
 wrote:

[comments inline]

> Steps to reproduce:
>
> Create an application with the Tree component instance and XMLListCollection
> dataProvider binded to it that contains 5 items:
>
> private var itemsXML : XML =
>  
>   
>   
>   
>   
>   
>  ;
>
> Expand Item 4.
> Drag and drop Item 5 from the root to the Item 4.
> Drag and drop Item 5 from the Item 4 to the root.
>
>
> Expected result: Item 5 is deleted from the Item 4 and appears on the root
> in the drop position.
>
> Actual result: Item 5 actually appears on the root in the drop position, but
> it is not removed from the Item 4, so there are 2 same elements in the
> hierarchy intead of one.

That's a good catch. You're right, it's because of parentMap not
getting updated on the first drag-drop. You'll see that the
HierarchicalCollectionView:collecitonChangeHandler has a call to
updateLength when the event kind is "update", but it has been
commented. I suspect that may be the reason for this bug. Anyhow, for
now, here's a workaround:

 

 function doWorkaround() {
   var e = new CollectionEvent("collectionChange");
   e.kind = "update";
   myXMLListCollection.dispatchEvent(e);
 }

See if that works.

This ought to be logged in the Flex bugbase.

Manish


[flexcoders] Tree is not correctly updated when dragging and dropping item twice when using XML data provider

2008-12-30 Thread Sergey Kovalyov
Hi All!

*Steps to reproduce:*

   1. Create an application with the Tree component instance and
   XMLListCollection dataProvider binded to it that contains 5 items:
  - private var itemsXML : XML =
   





   ;
   2. Expand Item 4.
   3. Drag and drop Item 5 from the root to the Item 4.
   4. Drag and drop Item 5 from the Item 4 to the root.


*Expected result:* Item 5 is deleted from the Item 4 and appears on the root
in the drop position.

*Actual result:* Item 5 actually appears on the root in the drop position,
but it is not removed from the Item 4, so there are 2 same elements in the
hierarchy intead of one.

*Details:* I have realized that HierarchicalCollectionView.parentMap hash is
not correctly updated and upon 1st drag and drop still contains nulls for
all items within the collection. Thus DefaultDataDescriptor.getParent()
returns wrong value and removeChildItem() in Tree.dragDropHandler() does not
work as expected.

You can find the test application source attached.

Sergey.


tree.mxml
Description: Binary data