Chapter 5. Lists, Tiles, and Trees
The three components covered in this chapter extend the mx.controls.listclasses.ListBase
class, and the methods for working with these data-driven controls
are consistent in their implementation and use. Each of these data-driven
controls has its children generated by a data provider and allows for
sorting, filtering, reordering, and the setting of visual components to
act as item renderers and item editors. These controls also allow for
dragging and dropping.
The recipes in this chapter focus on working with item renderers,
controlling selection, setting styles in ListBase
controls, and working with data
providers for different control types. This does not begin to exhaust the
topics in working with these ListBase
controls,
though. For more recipes on working with drag-and-drop, see Chapter 10, “Dragging and Dropping.” For recipes on working with skinning, see Chapter 9,
“Skinning and Styling.”
5.1. Create an Editable List
Problem
You need to create a list in which all the items are editable.
Solution
Set the editable
property
of the List
control
to true and listen for the itemEditBegin
and itemEditEnd
properties, or set the editedItemPosition
by passing an object
containing columnIndex
and rowIndex
properties.
Discussion
All List
controls can be made
editable by simply setting the list’s editable
property to true. This means that
each renderer will become an editor control with a TextInput
populated with the value currently
in the itemRenderer
that the ...
Get Flex 3 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.