Hello,
Just to let you know:
The solution is to first make a copy of the Data Provider :
(Assuming Data Provider is an ArrayCollection)

private var originalList:Array;
originalList = List.dataProvider.toData().sclice();


Now you can make all the drag & drop ops you want...
Afterward you just recreate your list once you want to 'reset'

List.dataProvider = new ArrayCollection(originalList.slice() );


(Using slice ensure a softcopy and protects the original data)

--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Setting sort must always be followed by refresh(), so what you tried
> wont work.  I think you have to create a new arraycoll from the sorted
> one via toArray
> 
>  
> 
> ________________________________
> 
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of icepaco33
> Sent: Thursday, November 15, 2007 8:04 AM
> To: [email protected]
> Subject: [flexcoders] Sorting a list and then allowing drag & drop
> 
>  
> 
> Greetings all,
> 
> I have a list that allows drag n' drop operations.
> 
> However I also want to implement a 'reset' operation where the list
> will rearrange all the items in the correct order.
> 
> So the obvious way is to do :
> 
> List.ListDataProvider.sort = _mySort;
> List.ListDataProvider.refresh()
> List.ListDataProvider.sort = null; 
> 
> Assuming ListDataProvider represents the list's data provider and
> _mySort is a Sort type that rearrange all my items in the correct order
> 
> However once I perform this operation, I find that the next time I
> will do a drag & drop then the item that I will drag will stay in
> place (but will not be selectable) and the drag will perform, meaning
> there will be 2 copies of the same item in my list...
> 
> Any ideas ?
>


Reply via email to