Friday, September 21, 2007

Flex Lists and Dragging - Replace instead of Move?

To save time on one of our recent projects, we decided to switch away from a tree data view to a list data view. Basically, we have a list on the left with the root objects and when you select one it loads in its children via WebORB and .NET into the list on the right.

Now, one of our specifications was to allow the dragging of a child item into a different parent. "Oh, simple!" we thought, "You just drag the child item from the list on the right into a new parent on the left." Not really.

Nobody considered the fact that lists only allow you to drop an item *between* two of its list elements, and not *into* one of its elements. This is for obvious reasons - normally you would not want to do this.

Now, I can handle the dragDrop event and rather than add the child item to the List, place it as a child into the new parent. Unfortunately, though, I can't figure out how to control the annoying little line that appears *between* list items on a dragOver. I did some hunting and thought, "wow, I can just override the ListBase dragOverHandler." Nope, the dragOverHandler does not allow an override. All I want is to completely highlight the item I am moving over to indicate that you will be moving the child into the parent.

Any ideas?

No comments: