User Guide

252 DataGrid component (Flash Professional only)
Lists perform worse as a function of their visible rows.
Although lists can display 5000 records, they cant render 5000 records at once. The more
visible rows (specified by the
rowCount property) you have on the Stage, the more work
the list must to do to render. Limiting the number of visible rows, if at all possible, is the
best solution.
Lists arent tables.
DataGrid components are intended to provide an interface for many records. Theyre not
designed to display complete information; theyre designed to display enough information
so that users can drill down to see more. The message view in Microsoft Outlook is a
prime example. You dont read the entire e-mail in the grid; the message would be difficult
to read and the client would perform terribly. Outlook displays enough information so
that a user can drill into the post to see the details.
Understanding the DataGrid component: data model
and view
Conceptually, the DataGrid component is composed of a data model and a view that displays
the data. The data model consists of three main parts:
DataProvider
This is a list of items with which to fill the data grid. Any array in the same frame as a
DataGrid component is automatically given methods (from the DataProvider API) that
let you manipulate data and broadcast changes to multiple views. Any object that
implements the DataProvider API can be assigned to the
DataGrid.dataProvider
property (including recordsets, data sets, and so on). The following code creates a data
provider called
myDP:
myDP = new Array({name:"Chris", price:"Priceless"}, {name:"Nigel",
price:"Cheap"});
Item
This is an ActionScript object used for storing the units of information in the cells of a
column. A data grid is really a list that can display more than one column of data. A list
can be thought of as an array; each indexed space of the list is an item. For the DataGrid
component, each item consists of fields. In the following code, the content between curly
braces (
{}) is an item:
myDP = new Array({name:"Chris", price:"Priceless"}, {name:"Nigel",
price:"Cheap"});