Tag Archives: List

Using DataRenderer to add custom states to a spark List renderer

ItemRenderer has logic built in that changes between some standard states like normal, hovered, selected, etc. You can supplement this logic by overriding ItemRenderer.getCurrentRendererState(), or do away with the built in states altogether by subclassing DataRenderer instead of ItemRenderer.
Continue reading Using DataRenderer to add custom states to a spark List renderer

Disable selection on some items in a spark List

The spark List component in Flex 4 treats every item equally with regards to selection. Sometimes I find it useful to customize this behavior so certain items cannot be selected. You can simulate this behavior by customizing the item renderer to make the selected state visually identical to the normal state, but to get more accurate functionality you will need to subclass List.
Continue reading Disable selection on some items in a spark List

Multiple selection in a spark List without the control key

The spark List component in Flex 4 allows you to select multiple items when you set allowMultipleSelection to true. With this flag set you can select multiple items by using the control/command key.

If you want to have a List that allows multiple selection, but does not require the user to hold down the control key when selecting items you can subclass List and override the item_mouseDownHandler() method.
Continue reading Multiple selection in a spark List without the control key

Binding warnings when using Object in a List dataProvider

If you have built a custom item renderer for a DataGroup or List you may have come across warnings in your Flash Builder console output similar to this:

warning: unable to bind to property 'firstName' on class 'Object' (class is not an IEventDispatcher)

Continue reading Binding warnings when using Object in a List dataProvider

Changing the position of the scroll bars in a spark List

The default spark List skin wraps the the underlying DataGroup with a Scroller component to easily provide scrolling functionality. Custom skinning the Scroller component isn’t very flexible; you can custom skin each scrollbar to change the visuals on them, but you can’t easily reposition them. In these cases it usually makes more sense to get rid of the Scroller and hook up the scrollbars directly.
Continue reading Changing the position of the scroll bars in a spark List

Expanding item renderers in a DataGroup or List

The spark DataGroup component is designed to take data items and pass them through an item renderer to create a visual representation of that data. In Flex 4 it is very easy to build custom item renderers.

This sample application demonstrates how you can create an item renderer that only shows some information by default and allows the user to drill down to see more information by clicking on an item or it’s associated “twisty” icon.

Continue reading Expanding item renderers in a DataGroup or List

Performance implications of the List itemRenderer vs. itemRendererFunction properties

The spark List component in Flex 4 has virtualization enabled by default. Virtualization is an optimization that only renders items that are currently in view which allows the List to support very large data sets. You can learn more about how virtualization works in Flex 4 by reading the Spark Virtualization Spec.
Continue reading Performance implications of the List itemRenderer vs. itemRendererFunction properties