Flexmaniacs - Sorting and Filtering and Drag and Drop
I went to two sessions this afternoon on Sorting and Filtering and on Drag and Drop. What struck me about these two is that despite some minor quirks they both showed how great Flex is.
The session on Sorting and Filtering by Scott Stroz was interesting and showed how fast Flex was at sorting and filtering large datasets of around 2000 or so records. It all seemed to happen in the blink of an eye!
The final session I went to was about Drag and Drop. For me this is the main reason for using a RIA over the traditional interface. Kevin Schmidt showed the easy and more difficult was to use Drag and Drop in Flex.
Here are my notes from the two sessions, a bit incomplete I'm afraid. I will link to the presentations if possible when they get posted.
Sorting data using ICollectionView Interface.
The class or property must implement the IcollectionView interface.The underlying dataset does not change. You can step though the data using a cursor. You can use bookmarks and you can insert and delete data (that does modify data in the collection).
mx:DataGridColumn has a default setting of true for the sortable property.
If you use mx:itemRenderer or labelFunction property to format a column the default sort will give unexpected results.
You have to write a sortCompare function that will return 0 if two elements are the same and –1 or +1 depending on which is greater in the sort sequence.
To sort an ArrayCollection:
- Create a new sort Object.
- Add fields to the sort Object.
Drag and Drop - With List Controls
List Controls have drag and drop built in to them and it only needs to be turned on with the properties:- dragEnabled for the place to drag from.
- dropEnabled for the place to drag to.
- dragMoveEnabled to enable an object to be moved.
To drop between controls the elements must have the same data type, or do a type conversion on the drop event.
With Controls which don't have drag and drop built in
import DragManager, Drag.... Listen for events mouseDown and mouseMove in the thing you want to drag.- dragEnter
- dragdrop
- dragExit
When the slides are posted I will add a link to them if I can.


Even if one uses Air as flex's running box, sqlite would sort/filter large data, faster than flex can ever achieve.
How we can sort data of some complex data types inside a datagrid.
I have one arrayCollection and it contains lotsa of Value Object like userVO,customerVO.
Now these objects have first name,last name etc. I have used labelFunction for display.
I want to know how we can sort the data. I have also created a class extending SortField and have passed a parameter on which there should be sorting. But I m kinda confused how it works.
Can you help me out in this or point it out some referance article where sorting is based on complex data inside Datagrid.?
Thanks in advance.