Chapter 18. Modeling and Managing Data
IN THIS CHAPTER
Using the
<fx:Model>
tag to model data itemsEmbedding data with
<fx:Model>
Creating value object classes in ActionScript
Storing data sets in client memory with the
ArrayList
andArrayCollection
classesFiltering and sorting data with the
ArrayCollection
classTraversing, searching, and bookmarking data objects with the
IViewCursor
interface
Flex applications are stateful; that is, they have the capability to remember data persistently for the duration of the user's session in a way that classic Web applications usually don't. One of the most common tasks you must accomplish as an application developer is to create a framework for storing data that the application can use at runtime.
The content of an application's data can come from many sources: XML files, databases or other server-side resources, or remote functions wrapped by and exposed as SOAP-style or Representational State Transfer (REST)-style Web services. Regardless of how the data comes to an application, though, a Flex application stores the data in exactly the same way: as a data model.
In this chapter, I describe common techniques for modeling data in Flex applications. I start with creating single-object data models: ActionScript classes designed to hold one instance of a data entity at a time. (A data instance might represent a row in a database table or a single element in an XML file.) You can represent such data instances with the <fx:Model>
tag, a generic data object, ...
Get Flash® Builder™ 4 and Flex® 4 Bible 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.