Package | fl.controls |
Class | public class DataGrid |
Inheritance | DataGrid SelectableList BaseScrollPane UIComponent Sprite DisplayObjectContainer InteractiveObject DisplayObject EventDispatcher Object |
Implements | IFocusManagerComponent |
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
A DataGrid component is well suited for the display of objects that contain multiple properties. The data that a DataGrid component displays can be contained in a DataProvider object or as an array of objects. The columns of a DataGrid component can be represented by a list of DataGridColumn objects, each of which contains information that is specific to the column.
The DataGrid component provides the following features:
- Columns of different widths or identical fixed widths
- Columns that the user can resize at run time
- Columns that the user can reorder at run time by using ActionScript
- Optional customizable column headers
- Support for custom item renderers to display data other than text in any column
- Support for sorting data by clicking on the column that contains it
The DataGrid component is composed of subcomponents including ScrollBar, HeaderRenderer, CellRenderer, DataGridCellEditor, and ColumnDivider components, all of which can be skinned during authoring or at run time.
The DataGrid component uses the following classes that can be found in the dataGridClasses package:
- DataGridColumn: Describes a column in a DataGrid component. Contains the indexes, widths, and other properties of the column. Does not contain cell data.
- HeaderRenderer: Displays the column header for the current DataGrid column. Contains the label and other properties of the column header.
- DataGridCellEditor: Manages the editing of the data for each cell.
Related API Elements
Property | Defined By | ||
---|---|---|---|
accessibilityImplementation : AccessibilityImplementation
The current accessibility implementation (AccessibilityImplementation)
for this InteractiveObject instance. | InteractiveObject | ||
accessibilityProperties : AccessibilityProperties
The current accessibility options for this display object. | DisplayObject | ||
allowMultipleSelection : Boolean
Gets a Boolean value that indicates whether more than one list item
can be selected at a time. | SelectableList | ||
alpha : Number
Indicates the alpha transparency value of the object specified. | DisplayObject | ||
blendMode : String
A value from the BlendMode class that specifies which blend mode to use. | DisplayObject | ||
blendShader : Shader [write-only]
Sets a shader that is used for blending the foreground and background. | DisplayObject | ||
buttonMode : Boolean
Specifies the button mode of this sprite. | Sprite | ||
cacheAsBitmap : Boolean
If set to true, Flash runtimes cache an internal bitmap representation of the
display object. | DisplayObject | ||
cacheAsBitmapMatrix : Matrix
If non-null, this Matrix object defines how a display object is rendered when
cacheAsBitmap is set to true. | DisplayObject | ||
columns : Array
Gets or sets an array of DataGridColumn objects, one for each column that can be displayed. | DataGrid | ||
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
contextMenu : NativeMenu
Specifies the context menu associated with this object. | InteractiveObject | ||
dataProvider : DataProvider
Gets or sets the data model of the list of items to be viewed. | SelectableList | ||
doubleClickEnabled : Boolean
Specifies whether the object receives doubleClick events. | InteractiveObject | ||
dropTarget : DisplayObject [read-only]
Specifies the display object over which the sprite is being dragged, or on
which the sprite was dropped. | Sprite | ||
editable : Boolean = false
Indicates whether or not the user can edit items in the data provider. | DataGrid | ||
editedItemPosition : Object
Gets or sets the column and row index of the item renderer for
the data provider item that is being edited. | DataGrid | ||
editedItemRenderer : ICellRenderer [read-only]
Gets a reference to the item renderer in the DataGrid component whose item is currently being
edited. | DataGrid | ||
enabled : Boolean
Gets or sets a value that indicates whether the component can accept user interaction. | UIComponent | ||
filters : Array
An indexed array that contains each filter object currently associated with the display object. | DisplayObject | ||
focusEnabled : Boolean
Gets or sets a Boolean value that indicates whether the component can receive focus
after the user clicks it. | UIComponent | ||
focusManager : IFocusManager
Gets or sets the FocusManager that controls focus for this component and its
peers. | UIComponent | ||
focusRect : Object
Specifies whether this object displays a focus rectangle. | InteractiveObject | ||
graphics : Graphics [read-only]
Specifies the Graphics object that belongs to this sprite where vector
drawing commands can occur. | Sprite | ||
headerHeight : Number
Gets or sets the height of the DataGrid header, in pixels. | DataGrid | ||
height : Number [override]
Gets or sets the height of the component, in pixels. | UIComponent | ||
hitArea : Sprite
Designates another sprite to serve as the hit area for a sprite. | Sprite | ||
horizontalLineScrollSize : Number
Gets or sets a value that describes the amount of content to be scrolled,
horizontally, when a scroll arrow is clicked. | BaseScrollPane | ||
horizontalPageScrollSize : Number
Gets or sets the count of pixels by which to move the scroll thumb
on the horizontal scroll bar when the scroll bar track is pressed. | BaseScrollPane | ||
horizontalScrollBar : ScrollBar [read-only]
Gets a reference to the horizontal scroll bar. | BaseScrollPane | ||
horizontalScrollPolicy : String [override]
Gets or sets a Boolean value that indicates whether the
horizontal scroll bar is always on. | DataGrid | ||
horizontalScrollPosition : Number
Gets or sets a value that describes the horizontal position of the
horizontal scroll bar in the scroll pane, in pixels. | BaseScrollPane | ||
imeMode : String
Gets or sets the mode of the input method editor (IME). | DataGrid | ||
itemEditorInstance : Object
A reference to the currently active instance of the item editor,
if one exists. | DataGrid | ||
labelFunction : Function
Gets or sets a function that determines which fields of each
item to use for the label text. | DataGrid | ||
length : uint [read-only]
Gets the number of items in the data provider. | SelectableList | ||
loaderInfo : LoaderInfo [read-only]
Returns a LoaderInfo object containing information about loading the file
to which this display object belongs. | DisplayObject | ||
mask : DisplayObject
The calling display object is masked by the specified mask object. | DisplayObject | ||
maxHorizontalScrollPosition : Number [override]
Gets or sets the number of pixels that the list scrolls to the right when the
horizontalScrollPolicy property is set to ScrollPolicy.ON. | SelectableList | ||
maxVerticalScrollPosition : Number [read-only]
Gets the maximum vertical scroll position for the current content, in pixels. | BaseScrollPane | ||
minColumnWidth : Number
Gets or sets the minimum width of a DataGrid column, in pixels. | DataGrid | ||
mouseChildren : Boolean
Determines whether or not the children of the object are mouse, or user input device, enabled. | DisplayObjectContainer | ||
mouseEnabled : Boolean
Specifies whether this object receives mouse, or other user input, messages. | InteractiveObject | ||
mouseFocusEnabled : Boolean
Gets or sets a value that indicates whether the component can receive focus after
the user clicks it. | UIComponent | ||
mouseX : Number [read-only]
Indicates the x coordinate of the mouse or user input device position, in pixels. | DisplayObject | ||
mouseY : Number [read-only]
Indicates the y coordinate of the mouse or user input device position, in pixels. | DisplayObject | ||
name : String
Indicates the instance name of the DisplayObject. | DisplayObject | ||
needsSoftKeyboard : Boolean
Specifies whether a virtual keyboard (an on-screen, software keyboard) should display
when this InteractiveObject instance receives focus. | InteractiveObject | ||
numChildren : int [read-only]
Returns the number of children of this object. | DisplayObjectContainer | ||
opaqueBackground : Object
Specifies whether the display object is opaque with a certain background color. | DisplayObject | ||
parent : DisplayObjectContainer [read-only]
Indicates the DisplayObjectContainer object that contains this display object. | DisplayObject | ||
prototype : Object [static]
A reference to the prototype object of a class or function object. | Object | ||
resizableColumns : Boolean = true
Indicates whether the user can change the size of the
columns. | DataGrid | ||
root : DisplayObject [read-only]
For a display object in a loaded SWF file, the root property is the
top-most display object in the portion of the display list's tree structure represented by that SWF file. | DisplayObject | ||
rotation : Number
Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation. | DisplayObject | ||
rotationX : Number
Indicates the x-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | ||
rotationY : Number
Indicates the y-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | ||
rotationZ : Number
Indicates the z-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | ||
rowCount : uint [override]
Gets or sets the number of rows that are at least partially visible in the
list. | DataGrid | ||
rowHeight : Number
Gets or sets the height of each row in the DataGrid component, in pixels. | DataGrid | ||
scale9Grid : Rectangle
The current scaling grid that is in effect. | DisplayObject | ||
scaleX : Number [override]
Multiplies the current width of the component by a scale factor. | UIComponent | ||
scaleY : Number [override]
Multiplies the current height of the component by a scale factor. | UIComponent | ||
scaleZ : Number
Indicates the depth scale (percentage) of an object as applied from the registration point of the object. | DisplayObject | ||
scrollRect : Rectangle
The scroll rectangle bounds of the display object. | DisplayObject | ||
selectable : Boolean
Gets or sets a Boolean value that indicates whether the items in the list
can be selected. | SelectableList | ||
selectedIndex : int
Gets or sets the index of the item that is selected in a single-selection
list. | SelectableList | ||
selectedIndices : Array
Gets or sets an array that contains the items that were selected from
a multiple-selection list. | SelectableList | ||
selectedItem : Object
Gets or sets the item that was selected from a single-selection list. | SelectableList | ||
selectedItems : Array
Gets or sets an array that contains the objects for the
items that were selected from the multiple-selection list. | SelectableList | ||
showHeaders : Boolean
Gets or sets a Boolean value that indicates whether the DataGrid component shows column headers. | DataGrid | ||
softKeyboardInputAreaOfInterest : Rectangle
Defines the area that should remain on-screen when a soft keyboard is displayed. | InteractiveObject | ||
sortableColumns : Boolean = true
Indicates whether the user can sort the items in the data provider
by clicking on a column header cell. | DataGrid | ||
sortDescending : Boolean [read-only]
Gets the order in which a column is sorted when
the user clicks its header. | DataGrid | ||
sortIndex : int [read-only]
Gets the index of the column to be sorted. | DataGrid | ||
soundTransform : flash.media:SoundTransform
Controls sound within this sprite. | Sprite | ||
stage : Stage [read-only]
The Stage of the display object. | DisplayObject | ||
tabChildren : Boolean
Determines whether the children of the object are tab enabled. | DisplayObjectContainer | ||
tabEnabled : Boolean
Specifies whether this object is in the tab order. | InteractiveObject | ||
tabIndex : int
Specifies the tab ordering of objects in a SWF file. | InteractiveObject | ||
textSnapshot : flash.text:TextSnapshot [read-only]
Returns a TextSnapshot object for this DisplayObjectContainer instance. | DisplayObjectContainer | ||
transform : flash.geom:Transform
An object with properties pertaining to a display object's matrix, color transform, and pixel bounds. | DisplayObject | ||
useBitmapScrolling : Boolean
When set to true, the cacheAsBitmap property for the scrolling content is set
to true; when set to false this value is turned off. | BaseScrollPane | ||
useHandCursor : Boolean
A Boolean value that indicates whether the pointing hand (hand cursor) appears when the pointer rolls
over a sprite in which the buttonMode property is set to true. | Sprite | ||
verticalLineScrollSize : Number
Gets or sets a value that describes how many pixels to scroll vertically when a scroll arrow is clicked. | BaseScrollPane | ||
verticalPageScrollSize : Number
Gets or sets the count of pixels by which to move the scroll thumb
on the vertical scroll bar when the scroll bar track is pressed. | BaseScrollPane | ||
verticalScrollBar : ScrollBar [read-only]
Gets a reference to the vertical scroll bar. | BaseScrollPane | ||
verticalScrollPolicy : String
Gets or sets a value that indicates the state of the vertical scroll
bar. | BaseScrollPane | ||
verticalScrollPosition : Number
Gets or sets a value that describes the vertical position of the
vertical scroll bar in the scroll pane, in pixels. | BaseScrollPane | ||
visible : Boolean [override]
Gets or sets a value that indicates whether the current component instance is visible. | UIComponent | ||
width : Number [override]
Gets or sets the width of the component, in pixels. | UIComponent | ||
x : Number [override]
Gets or sets the x coordinate that represents the position of the component along
the x axis within its parent container. | UIComponent | ||
y : Number [override]
Gets or sets the y coordinate that represents the position of the component along
the y axis within its parent container. | UIComponent | ||
z : Number
Indicates the z coordinate position along the z-axis of the DisplayObject
instance relative to the 3D parent container. | DisplayObject |
Method | Defined By | ||
---|---|---|---|
DataGrid()
Creates a new DataGrid component instance. | DataGrid | ||
Adds a child DisplayObject instance to this DisplayObjectContainer instance. | DisplayObjectContainer | ||
Adds a child DisplayObject instance to this DisplayObjectContainer
instance. | DisplayObjectContainer | ||
Adds a column to the end of the columns array. | DataGrid | ||
Inserts a column at the specified index in the columns array. | DataGrid | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | EventDispatcher | ||
Appends an item to the end of the list of items. | SelectableList | ||
Inserts an item into the list at the specified index location. | SelectableList | ||
Indicates whether the security restrictions
would cause any display objects to be omitted from the list returned by calling
the DisplayObjectContainer.getObjectsUnderPoint() method
with the specified point point. | DisplayObjectContainer | ||
Clears a style that is set on the renderers in the list. | SelectableList | ||
Clears the currently selected item in the list and sets the selectedIndex property to -1. | SelectableList | ||
Deletes a style property from this component instance. | UIComponent | ||
Determines whether the specified display object is a child of the DisplayObjectContainer instance or
the instance itself. | DisplayObjectContainer | ||
Uses the editor specified by the itemEditor property to
create an item editor for the item renderer at the column and row index
identified by the editedItemPosition property. | DataGrid | ||
Closes an item editor that is currently open on an item renderer. | DataGrid | ||
Dispatches an event into the event flow. | EventDispatcher | ||
Shows or hides the focus indicator on this component. | UIComponent | ||
Initiates an immediate draw operation, without invalidating everything as invalidateNow does. | UIComponent | ||
Edits a given field or property in the DataGrid component. | DataGrid | ||
Returns a rectangle that defines the area of the display object relative to the coordinate system
of the targetCoordinateSpace object. | DisplayObject | ||
Get the instance of a cell renderer at the specified position
in the DataGrid. | DataGrid | ||
Returns the child display object instance that exists at the specified index. | DisplayObjectContainer | ||
Returns the child display object that exists with the specified name. | DisplayObjectContainer | ||
Returns the index position of a child DisplayObject instance. | DisplayObjectContainer | ||
Retrieves the column that is located at the specified index of the columns array. | DataGrid | ||
Retrieves the number of columns in the DataGrid component. | DataGrid | ||
Retrieves the index of the column of the specified name,
or -1 if no match is found. | DataGrid | ||
Retrieves the object that currently has focus. | UIComponent | ||
Retrieves the item at the specified index. | SelectableList | ||
Returns the index of the next item in the dataProvider in which
the label's first character matches a specified string character. | SelectableList | ||
Returns an array of objects that lie under the specified point and are children
(or grandchildren, and so on) of this DisplayObjectContainer instance. | DisplayObjectContainer | ||
Returns a rectangle that defines the boundary of the display object,
based on the coordinate system defined by the targetCoordinateSpace
parameter, excluding any strokes on shapes. | DisplayObject | ||
Retrieves a style that is set on the renderers in the list. | SelectableList | ||
Retrieves a style property that is set in the style lookup
chain of the component. | UIComponent | ||
[static]
Retrieves the default style map for the current component. | DataGrid | ||
Converts the point object from the Stage (global) coordinates
to the display object's (local) coordinates. | DisplayObject | ||
Converts a two-dimensional point from the Stage (global) coordinates to a
three-dimensional display object's (local) coordinates. | DisplayObject | ||
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | EventDispatcher | ||
Indicates whether an object has a specified property defined. | Object | ||
Evaluates the bounding box of the display object to see if it overlaps or intersects with the
bounding box of the obj display object. | DisplayObject | ||
Evaluates the display object to see if it overlaps or intersects with the
point specified by the x and y parameters. | DisplayObject | ||
Marks a property as invalid and redraws the component on the
next frame unless otherwise specified. | UIComponent | ||
Invalidates a specific item renderer. | SelectableList | ||
Invalidates the renderer for the item at the specified index. | SelectableList | ||
Invalidates the whole list, forcing the list items to be redrawn. | SelectableList | ||
Checks whether the specified item is selected in the list. | SelectableList | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
[override]
The DataGrid component has multiple cells for any given item, so the itemToCellRenderer
method always returns null. | DataGrid | ||
Retrieves the string that the renderer displays for the given data object
based on the label properties of the object. | SelectableList | ||
Converts a three-dimensional point of the three-dimensional display
object's (local) coordinates to a two-dimensional point in the Stage (global) coordinates. | DisplayObject | ||
Converts the point object from the display object's (local) coordinates to the
Stage (global) coordinates. | DisplayObject | ||
[static]
Merges the styles from multiple classes into one object. | UIComponent | ||
Moves the component to the specified position within its parent. | UIComponent | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Removes all items from the list. | SelectableList | ||
Removes all columns from the DataGrid component. | DataGrid | ||
Removes the specified child DisplayObject instance from the child list of the DisplayObjectContainer instance. | DisplayObjectContainer | ||
Removes a child DisplayObject from the specified index position in the child list of
the DisplayObjectContainer. | DisplayObjectContainer | ||
Removes one or more child DisplayObject instances from the DisplayObjectContainer instance. | DisplayObjectContainer | ||
Removes the column that is located at the specified index of the columns array. | DataGrid | ||
Removes a listener from the EventDispatcher object. | EventDispatcher | ||
Removes the specified item from the list. | SelectableList | ||
Removes the item at the specified index position. | SelectableList | ||
Replaces the item at the specified index location with another item. | SelectableList | ||
Raises a virtual keyboard. | InteractiveObject | ||
[override]
Scrolls the list to the item at the specified index. | DataGrid | ||
Scrolls the list to the item at the location indicated by
the current value of the selectedIndex property. | SelectableList | ||
Changes the position of an existing child in the display object container. | DisplayObjectContainer | ||
Sets the focus to this component. | UIComponent | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Sets a style on the renderers in the list. | SelectableList | ||
Sets the component to the specified width and height. | UIComponent | ||
Sets a style property on this component instance. | UIComponent | ||
Sorts the elements of the current data provider. | SelectableList | ||
Sorts the elements of the current data provider by one or more
of its fields. | SelectableList | ||
Resets the widths of the visible columns to the same size. | DataGrid | ||
Lets the user drag the specified sprite. | Sprite | ||
Lets the user drag the specified sprite on a touch-enabled device. | Sprite | ||
Ends the startDrag() method. | Sprite | ||
Ends the startTouchDrag() method, for use with touch-enabled devices. | Sprite | ||
Swaps the z-order (front-to-back order) of the two specified child objects. | DisplayObjectContainer | ||
Swaps the z-order (front-to-back order) of the child objects at the two specified index positions in the
child list. | DisplayObjectContainer | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Validates and updates the properties and layout of this object, redrawing it
if necessary. | UIComponent | ||
Returns the primitive value of the specified object. | Object | ||
Checks whether an event listener is registered with this EventDispatcher object or any of
its ancestors for the specified event type. | EventDispatcher |
Event | Summary | Defined By | ||
---|---|---|---|---|
[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher | |||
Dispatched when a display object is added to the display list. | DisplayObject | |||
Dispatched when a display object is added to the on stage display list, either directly or through the addition of a sub tree in which the display object is contained. | DisplayObject | |||
Dispatched when a different item is selected in the list. | SelectableList | |||
Dispatched when the user selects 'Clear' (or 'Delete') from the text context menu. | InteractiveObject | |||
Dispatched when a user presses and releases the main button of the user's pointing device over the same InteractiveObject. | InteractiveObject | |||
Dispatched after a user expands a column horizontally. | DataGrid | |||
Dispatched when a user gesture triggers the context menu associated with this interactive object in an AIR application. | InteractiveObject | |||
Dispatched when the user activates the platform-specific accelerator key combination for a copy operation or selects 'Copy' from the text context menu. | InteractiveObject | |||
Dispatched when the user activates the platform-specific accelerator key combination for a cut operation or selects 'Cut' from the text context menu. | InteractiveObject | |||
[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher | |||
Dispatched when a user presses and releases the main button of a pointing device twice in rapid succession over the same InteractiveObject when that object's doubleClickEnabled flag is set to true. | InteractiveObject | |||
[broadcast event] Dispatched when the playhead is entering a new frame. | DisplayObject | |||
[broadcast event] Dispatched when the playhead is exiting the current frame. | DisplayObject | |||
Dispatched after a display object gains focus. | InteractiveObject | |||
Dispatched after a display object loses focus. | InteractiveObject | |||
[broadcast event] Dispatched after the constructors of frame display objects have run but before frame scripts have run. | DisplayObject | |||
Dispatched when the user moves a point of contact over the InteractiveObject instance on a touch-enabled device (such as moving a finger from left to right over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user creates a point of contact with an InteractiveObject instance, then taps on a touch-enabled device (such as placing several fingers over a display object to open a menu and then taps one finger to select a menu item on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user performs a rotation gesture at a point of contact with an InteractiveObject instance (such as touching two fingers and rotating them over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user performs a swipe gesture at a point of contact with an InteractiveObject instance (such as touching three fingers to a screen and then moving them in parallel over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user presses two points of contact over the same InteractiveObject instance on a touch-enabled device (such as presses and releases two fingers over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user performs a zoom gesture at a point of contact with an InteractiveObject instance (such as touching two fingers to a screen and then quickly spreading the fingers apart over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched after the user clicks a header cell. | DataGrid | |||
Dispatched after the component visibility changes from visible to invisible. | UIComponent | |||
This event is dispatched to any client app that supports inline input with an IME | InteractiveObject | |||
Dispatched when the user clicks an item in the component. | SelectableList | |||
Dispatched when the user clicks an item in the component twice in rapid succession. | SelectableList | |||
Dispatched after the editedItemPosition property is set and the item can be edited. | DataGrid | |||
Dispatched after a user prepares to edit an item, for example, by releasing the mouse button over the item. | DataGrid | |||
Dispatched when an item editing session ends for any reason. | DataGrid | |||
Dispatched after an item receives focus. | DataGrid | |||
Dispatched after an item loses focus. | DataGrid | |||
Dispatched when the user rolls the pointer off of an item in the component. | SelectableList | |||
Dispatched when the user rolls the pointer over an item in the component. | SelectableList | |||
Dispatched when the user presses a key. | InteractiveObject | |||
Dispatched when the user attempts to change focus by using keyboard navigation. | InteractiveObject | |||
Dispatched when the user releases a key. | InteractiveObject | |||
Dispatched when a user presses and releases the middle button of the user's pointing device over the same InteractiveObject. | InteractiveObject | |||
Dispatched when a user presses the middle pointing device button over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when a user presses the pointing device button over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when the user attempts to change focus by using a pointer device. | InteractiveObject | |||
Dispatched when a user moves the pointing device while it is over an InteractiveObject. | InteractiveObject | |||
Dispatched when the user moves a pointing device away from an InteractiveObject instance. | InteractiveObject | |||
Dispatched when the user moves a pointing device over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when a mouse wheel is spun over an InteractiveObject instance. | InteractiveObject | |||
Dispatched after the component is moved. | UIComponent | |||
Dispatched by the drag initiator InteractiveObject when the user releases the drag gesture. | InteractiveObject | |||
Dispatched by the target InteractiveObject when a dragged object is dropped on it and the drop has been accepted with a call to DragManager.acceptDragDrop(). | InteractiveObject | |||
Dispatched by an InteractiveObject when a drag gesture enters its boundary. | InteractiveObject | |||
Dispatched by an InteractiveObject when a drag gesture leaves its boundary. | InteractiveObject | |||
Dispatched by an InteractiveObject continually while a drag gesture remains within its boundary. | InteractiveObject | |||
Dispatched at the beginning of a drag operation by the InteractiveObject that is specified as the drag initiator in the DragManager.doDrag() call. | InteractiveObject | |||
Dispatched during a drag operation by the InteractiveObject that is specified as the drag initiator in the DragManager.doDrag() call. | InteractiveObject | |||
Dispatched when the user activates the platform-specific accelerator key combination for a paste operation or selects 'Paste' from the text context menu. | InteractiveObject | |||
Dispatched when the user lowers an active stylus past the proximity detection threshold of the screen. | InteractiveObject | |||
Dispatched when the user lifts an active stylus above the proximity detection threshold of the screen. | InteractiveObject | |||
Dispatched when the user moves an active stylus over the screen while remaining within the proximity detection threshold. | InteractiveObject | |||
Dispatched when the user moves an active stylus away from this InteractiveObject while remaining within the proximity detection threshold of the screen. | InteractiveObject | |||
Dispatched when the user moves an active stylus directly above this InteractiveObject while remaining within the proximity detection threshold of the screen. | InteractiveObject | |||
Dispatched when the user moves an active stylus away from this InteractiveObject and any of its children while remaining within the proximity detection threshold of the screen. | InteractiveObject | |||
Dispatched when the user moves an active stylus over this InteractiveObject from outside the object's tree of descendents in the display list (while remaining within the proximity detection threshold of the screen). | InteractiveObject | |||
Dispatched when a display object is about to be removed from the display list. | DisplayObject | |||
Dispatched when a display object is about to be removed from the display list, either directly or through the removal of a sub tree in which the display object is contained. | DisplayObject | |||
[broadcast event] Dispatched when the display list is about to be updated and rendered. | DisplayObject | |||
Dispatched after the component is resized. | UIComponent | |||
Dispatched when a user presses and releases the right button of the user's pointing device over the same InteractiveObject. | InteractiveObject | |||
Dispatched when a user presses the pointing device button over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when the user rolls the pointer off of the component. | SelectableList | |||
Dispatched when the user rolls the pointer over the component. | SelectableList | |||
Dispatched when the user scrolls horizontally or vertically. | SelectableList | |||
Dispatched when the user activates the platform-specific accelerator key combination for a select all operation or selects 'Select All' from the text context menu. | InteractiveObject | |||
Dispatched after the component visibility changes from invisible to visible. | UIComponent | |||
Dispatched immediately after the soft keyboard is raised. | InteractiveObject | |||
Dispatched immediately before the soft keyboard is raised. | InteractiveObject | |||
Dispatched immediately after the soft keyboard is lowered. | InteractiveObject | |||
Dispatched when the value of the object's tabChildren flag changes. | InteractiveObject | |||
Dispatched when the object's tabEnabled flag changes. | InteractiveObject | |||
Dispatched when the value of the object's tabIndex property changes. | InteractiveObject | |||
Dispatched when a user enters one or more characters of text. | InteractiveObject | |||
Dispatched when the user first contacts a touch-enabled device (such as touches a finger to a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user removes contact with a touch-enabled device (such as lifts a finger off a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user moves the point of contact with a touch-enabled device (such as drags a finger across a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user moves the point of contact away from InteractiveObject instance on a touch-enabled device (such as drags a finger from one display object to another on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user moves the point of contact over an InteractiveObject instance on a touch-enabled device (such as drags a finger from a point outside a display object to a point over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user moves the point of contact away from an InteractiveObject instance on a touch-enabled device (such as drags a finger from over a display object to a point outside the display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user moves the point of contact over an InteractiveObject instance on a touch-enabled device (such as drags a finger from a point outside a display object to a point over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user lifts the point of contact over the same InteractiveObject instance on which the contact was initiated on a touch-enabled device (such as presses and releases a finger from a single point over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject |
Styles are either common or associated with a specific theme. If the style is common, it can be used with any theme. If a style is associated with a specific theme, it can only be used if your application uses that theme.
Style | Description | Defined By | ||
---|---|---|---|---|
Type: Class The class that provides the cell renderer for each item in the component. | SelectableList | |||
columnDividerSkin | Type: Class The name of the class that provides the divider that appears between columns. The default value is DataGrid_columnDividerSkin . | DataGrid | ||
columnStretchCursorSkin | Type: Class The name of the class that provides the cursor that is used when the mouse is between two column headers and the resizableColumns
property is set to true .
The default value is DataGrid_columnStretchCursorSkin . | DataGrid | ||
Type: Number Format: Length The padding that separates the border of the list from its contents, in pixels. | SelectableList | |||
Type: Number The alpha value to set the list to when the enabled property is false . | SelectableList | |||
Type: flash.text.TextFormat The TextFormat object to use to render the component label when the button is disabled. | UIComponent | |||
Type: Class Name of the class to use as the skin for the down arrow button of the scroll bar when it is disabled. | BaseScrollPane | |||
Type: Class Name of the class to use as the skin for the down arrow button of the scroll bar when you click the arrow button. | BaseScrollPane | |||
Type: Class Name of the class to use as the skin for the down arrow button of the scroll bar when the mouse pointer is over the arrow button. | BaseScrollPane | |||
Type: Class Name of the class to use as the skin for the down arrow button of the scroll bar. | BaseScrollPane | |||
Type: Number Format: Length The padding that separates the outside boundaries of the component from the outside edges of the focus indicator, in pixels. | UIComponent | |||
Type: Class The skin to be used to display focus indicators. | UIComponent | |||
headerDisabledSkin | Type: Class The name of the class that provides the background for each column header when the component is disabled. The default value is HeaderRenderer_disabledSkin . | DataGrid | ||
headerDisabledTextFormat | Type: flash.text.TextFormat The format to be applied to the text contained in each column header when the component is disabled. The default value is null . | DataGrid | ||
headerDownSkin | Type: Class The name of the class that provides the background for each column header when the mouse is down. The default value is HeaderRenderer_downSkin . | DataGrid | ||
headerOverSkin | Type: Class The name of the class that provides the background for each column header when the mouse is over it. The default value is HeaderRenderer_overSkin . | DataGrid | ||
headerRenderer | Type: Class The name of the class that provides each column header. The default value is fl.controls.dataGridClasses.HeaderRenderer . | DataGrid | ||
headerSortArrowAscSkin | Type: Class The name of the class that provides the sort arrow when the sorted column is in ascending order. The default value is HeaderSortArrow_ascIcon . | DataGrid | ||
headerSortArrowDescSkin | Type: Class The name of the class that provides the sort arrow when the sorted column is in descending order. The default value is HeaderSortArrow_descIcon . | DataGrid | ||
headerTextFormat | Type: flash.text.TextFormat The format to be applied to the text contained in each column header. The default value is null . | DataGrid | ||
headerTextPadding | Type: Number Format: Length The padding that separates the column header border from the column header text, in pixels. The default value is 5 . | DataGrid | ||
headerUpSkin | Type: Class The name of the class that provides the background for each column header. The default value is HeaderRenderer_upSkin . | DataGrid | ||
Type: Number Format: Time The number of milliseconds to wait after the buttonDown event is first dispatched before sending a second buttonDown event. | BaseScrollPane | |||
Type: Number Format: Time The interval, in milliseconds, between buttonDown events that are dispatched after the delay that is specified by the repeatDelay style. | BaseScrollPane | |||
Type: Class The class that provides the skin for the background of the component. | SelectableList | |||
Type: flash.text.TextFormat The TextFormat object to use to render the component label. | UIComponent | |||
Type: Class The skin that is used to indicate the disabled state of the thumb. | BaseScrollPane | |||
Type: Class Name of the class to use as the skin for the thumb of the scroll bar when you click the thumb. | BaseScrollPane | |||
Type: Class Name of the class to use as the icon for the thumb of the scroll bar. | BaseScrollPane | |||
Type: Class Name of the class to use as the skin for the thumb of the scroll bar when the mouse pointer is over the thumb. | BaseScrollPane | |||
Type: Class Name of the class to use as the skin used for the thumb of the scroll bar. | BaseScrollPane | |||
Type: Class The skin that is used to indicate a disabled track. | BaseScrollPane | |||
Type: Class The skin that is used to indicate the down state of a disabled skin. | BaseScrollPane | |||
Type: Class The skin that is used to indicate the mouseover state for the scroll track. | BaseScrollPane | |||
Type: Class The skin used to indicate the mouse up state for the scroll track. | BaseScrollPane | |||
Type: Class Name of the class to use as the skin for the up arrow button of the scroll bar when it is disabled. | BaseScrollPane | |||
Type: Class Name of the class to use as the skin for the up arrow button of the scroll bar when you click the arrow button. | BaseScrollPane | |||
Type: Class Name of the class to use as the skin for the up arrow button of the scroll bar when the mouse pointer is over the arrow button. | BaseScrollPane | |||
Type: Class Name of the class to use as the skin for the up arrow button of the scroll bar. | BaseScrollPane |
columns | property |
columns:Array
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets an array of DataGridColumn objects, one for each column that can be displayed. If not explicitly set, the DataGrid component examines the first item in the data provider, locates its properties, and then displays those properties in alphabetic order.
You can make changes to the columns and to their order in this DataGridColumn
array. After the changes are made, however, you must explicitly assign the
changed array to the columns
property. If an explicit assignment
is not made, the set of columns that was used before will continue to be used.
The default value is [].
Implementation
public function get columns():Array
public function set columns(value:Array):void
Example ( How to use this example )
columns
array:
import fl.controls.DataGrid; import fl.controls.ScrollPolicy; import fl.data.DataProvider; var i:uint; var totalRows:uint = 16; var dp:DataProvider = new DataProvider(); for (i = 0; i < totalRows; i++) { dp.addItem({col1:getRandomNumber(), col2:getRandomNumber(), col3:getRandomNumber(), col4:getRandomNumber()}); } var dg:DataGrid = new DataGrid(); dg.setSize(200, 300); dg.columns = ["col1", "col2", "col3"]; dg.dataProvider = dp; addChild(dg); function getRandomNumber():uint { return Math.round(Math.random() * 100); }
columns
array and the getColumnCount()
method:
import fl.controls.DataGrid; import fl.controls.ScrollPolicy; import fl.data.DataProvider; var i:uint; var totalRows:uint = 16; var dp:DataProvider = new DataProvider(); for (i = 0; i < totalRows; i++) { dp.addItem({col1:getRandomNumber(), col2:getRandomNumber(), col3:getRandomNumber(), col4:getRandomNumber()}); } var dg:DataGrid = new DataGrid(); dg.setSize(200, 300); dg.columns = ["col1", "col2", "col3"]; dg.dataProvider = dp; addChild(dg); trace("columns.length:", dg.columns.length); // 3 trace("getColumnCount():", dg.getColumnCount()); // 3 function getRandomNumber():uint { return Math.round(Math.random() * 100); }
editable | property |
public var editable:Boolean = false
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Indicates whether or not the user can edit items in the data provider.
A value of true
indicates that the user can edit items in the
data provider; a value of false
indicates that the user cannot.
If this value is true
, the item renderers in the component
are editable. The user can click on an item renderer to open an editor.
You can turn off editing for individual columns of the DataGrid component
by using the DataGridColumn.editable
property, or by handling
the itemEditBeginning
and itemEditBegin
events.
The default value is false.
Related API Elements
editedItemPosition | property |
editedItemPosition:Object
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the column and row index of the item renderer for
the data provider item that is being edited. If no item is being
edited, this property is null
.
This object has two fields:
columnIndex
: The zero-based column index of the current itemrowIndex
: The zero-based row index of the current item
For example: { columnIndex:2, rowIndex:3 }
Setting this property scrolls the item into view and dispatches the
itemEditBegin
event to open an item editor on the specified
item renderer.
The default value is null.
Implementation
public function get editedItemPosition():Object
public function set editedItemPosition(value:Object):void
Related API Elements
Example ( How to use this example )
import fl.data.DataProvider; import fl.controls.*; var dp:DataProvider = new DataProvider(); var totalEntries:uint = 42; var i:uint; for(i=0; i<totalEntries; i++) { dp.addItem( { col1:"CellName", col2:"CellName", col3:"CellName" } ); } var dg:DataGrid = new DataGrid(); dg.columns = [ "col1", "col2", "col3" ]; dg.editable = true; dg.dataProvider = dp; dg.move(200,10); dg.setSize(200,300); addChild(dg); var rowIntro:Label = new Label(); rowIntro.text = "Row to edit:"; rowIntro.move(10,10); var colIntro:Label = new Label(); colIntro.text = "Column to edit:"; colIntro.move(10,30); var rowInputField:TextInput = new TextInput(); rowInputField.move(100,10); rowInputField.setSize(30,20); var colInputField:TextInput = new TextInput(); colInputField.move(100,30); colInputField.setSize(30,20); var editButton:Button = new Button(); editButton.move(10,60); editButton.label = "Edit"; editButton.addEventListener(MouseEvent.CLICK,editGrid); addChild(rowIntro); addChild(colIntro); addChild(rowInputField); addChild(colInputField); addChild(editButton); function editGrid(e:MouseEvent):void { dg.editedItemPosition = { rowIndex:Number(rowInputField.text), columnIndex:Number(colInputField.text) }; }
editedItemRenderer | property |
editedItemRenderer:ICellRenderer
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets a reference to the item renderer in the DataGrid component whose item is currently being
edited. If no item is being edited, this property contains a value of null
.
You can obtain the current value of the item that is being edited by using the
editedItemRenderer.data
property from an event listener for the
itemEditBegin
event or the itemEditEnd
event.
This is a read-only property. To set a custom item editor, use the itemEditor
property of the class that represents the relevant column.
Implementation
public function get editedItemRenderer():ICellRenderer
Related API Elements
Example ( How to use this example )
import fl.data.DataProvider; import fl.controls.*; var dp:DataProvider = new DataProvider(); var totalEntries:uint = 42; var i:uint; for(i=0; i<totalEntries; i++) { dp.addItem( { col1:"CellName", col2:"CellName", col3:"CellName" } ); } var dg:DataGrid = new DataGrid(); dg.columns = [ "col1", "col2", "col3" ]; dg.editable = true; dg.dataProvider = dp; dg.move(200,10); dg.setSize(200,300); addChild(dg); var rowIntro:Label = new Label(); rowIntro.text = "Row to edit:"; rowIntro.move(10,10); var colIntro:Label = new Label(); colIntro.text = "Column to edit:"; colIntro.move(10,30); var rowInputField:TextInput = new TextInput(); rowInputField.move(100,10); rowInputField.setSize(30,20); var colInputField:TextInput = new TextInput(); colInputField.move(100,30); colInputField.setSize(30,20); var editButton:Button = new Button(); editButton.move(10,60); editButton.label = "Edit"; editButton.addEventListener(MouseEvent.CLICK,editGrid); addChild(rowIntro); addChild(colIntro); addChild(rowInputField); addChild(colInputField); addChild(editButton); function editGrid(e:MouseEvent):void { dg.editedItemPosition = { rowIndex:Number(rowInputField.text), columnIndex:Number(colInputField.text) }; }
headerHeight | property |
headerHeight:Number
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the height of the DataGrid header, in pixels.
The default value is 25.
Implementation
public function get headerHeight():Number
public function set headerHeight(value:Number):void
Related API Elements
Example ( How to use this example )
headerHeight
property of a DataGrid component instance:
import fl.controls.DataGrid; import fl.controls.Slider; import fl.events.SliderEvent; var headerHeightSlider:Slider = new Slider(); headerHeightSlider.minimum = 20; headerHeightSlider.maximum = 40; headerHeightSlider.snapInterval = 2; headerHeightSlider.tickInterval = 4; headerHeightSlider.liveDragging = true; headerHeightSlider.move(10, 10); headerHeightSlider.addEventListener(SliderEvent.CHANGE, changeHandler); addChild(headerHeightSlider); var myDataGrid:DataGrid = new DataGrid(); myDataGrid.headerHeight = headerHeightSlider.value; myDataGrid.addColumn("name"); myDataGrid.addColumn("value"); myDataGrid.addItem({name:"Person A", value:0.85}); myDataGrid.addItem({name:"Person B", value:0.87}); myDataGrid.width = 200; myDataGrid.rowCount = myDataGrid.length; myDataGrid.move(10, 30); addChild(myDataGrid); function changeHandler(event:SliderEvent):void { myDataGrid.headerHeight = event.value; myDataGrid.rowCount = myDataGrid.length; }
horizontalScrollPolicy | property |
horizontalScrollPolicy:String
[override] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets a Boolean value that indicates whether the horizontal scroll bar is always on. The following list describes the valid values:
ScrollPolicy.ON
: The scroll bar is always on.ScrollPolicy.OFF
: The scroll bar is always off.ScrollPolicy.AUTO
: The state of the scroll bar changes based on the parameters that are passed to thesetScrollBarProperties()
method.
Note: If the combined width of the visible columns in the DataGrid
component is smaller than the available width of the DataGrid component, the columns may not expand to fill
the available space of the DataGrid component, depending on the value of the
horizontalScrollPolicy
property. The following list describes
these values and their effects:
ScrollPolicy.ON
: The horizontal scroll bar is disabled. The columns do not expand to fill the available space of the DataGrid component.ScrollPolicy.AUTO
: The horizontal scroll bar is not visible. The columns do not expand to fill the available space of the DataGrid component.
The default value is ScrollPolicy.OFF.
Implementation
override public function get horizontalScrollPolicy():String
override public function set horizontalScrollPolicy(value:String):void
Related API Elements
Example ( How to use this example )
import fl.controls.DataGrid; import fl.controls.ScrollPolicy; import fl.data.DataProvider; var i:uint; var totalRows:uint = 42; var dp:DataProvider = new DataProvider(); for (i = 0; i < totalRows; i++) { dp.addItem({col1:getRandomNumber(), col2:getRandomNumber(), col3:getRandomNumber(), col4:getRandomNumber(), col5:getRandomNumber(), col6:getRandomNumber(), col7:getRandomNumber()}); } var dg:DataGrid = new DataGrid(); dg.setSize(200,300); dg.addColumn("col1"); dg.addColumn("col2"); dg.addColumn("col3"); dg.addColumn("col4"); dg.addColumn("col5"); dg.addColumn("col6"); dg.addColumn("col7"); dg.dataProvider = dp; dg.horizontalScrollPolicy = ScrollPolicy.ON; addChild(dg); function getRandomNumber():uint { return Math.round(Math.random() * 100); }
imeMode | property |
imeMode:String
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the mode of the input method editor (IME). The IME makes it possible for users to use a QWERTY keyboard to enter characters from the Chinese, Japanese, and Korean character sets.
Flash sets the IME to the specified mode when the component gets focus, and restores it to the original value after the component loses focus.
The flash.system.IMEConversionMode class defines constants for
the valid values for this property. Set this property to null
to
prevent the use of the IME with the component.
Implementation
public function get imeMode():String
public function set imeMode(value:String):void
Related API Elements
itemEditorInstance | property |
public var itemEditorInstance:Object
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
A reference to the currently active instance of the item editor, if one exists.
To access the item editor instance and the new item value when an
item is being edited, use the itemEditorInstance
property. The itemEditorInstance
property is not valid
until after the event listener for the itemEditBegin
event executes. For this reason, the itemEditorInstance
property
is typically accessed from the event listener for the itemEditEnd
event.
The DataGridColumn.itemEditor
property defines the
class of the item editor, and therefore, the data type of the
item editor instance.
Related API Elements
Example ( How to use this example )
itemEditorInstance
property of a data grid to determine
the text of a cell after it has been edited:
import fl.data.DataProvider; import fl.controls.DataGrid; import fl.controls.dataGridClasses.DataGridCellEditor; import fl.controls.listClasses.ListData; import fl.events.DataGridEvent; var dp:DataProvider = new DataProvider(); var totalEntries:uint = 42; var i:uint; for(i=0; i<totalEntries; i++) { dp.addItem( { col1:"CellName", col2:"CellName", col3:"CellName" } ); } var dg:DataGrid = new DataGrid(); dg.addEventListener(DataGridEvent.ITEM_EDIT_END,onItemEditEnd); dg.dataProvider = dp; dg.editable = true; dg.setSize(300,200); addChild(dg); function onItemEditEnd(e:DataGridEvent):void { var cellEditor:DataGridCellEditor = dg.itemEditorInstance as DataGridCellEditor; var listData:ListData = cellEditor.listData; trace("After Edit: " + cellEditor.text); }
labelFunction | property |
labelFunction:Function
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets a function that determines which fields of each item to use for the label text.
The default value is null.
Implementation
public function get labelFunction():Function
public function set labelFunction(value:Function):void
Example ( How to use this example )
import fl.controls.DataGrid; import fl.controls.ScrollPolicy; import fl.controls.dataGridClasses.DataGridColumn; import fl.data.DataProvider; var i:uint; var totalRows:uint = 16; var dp:DataProvider = new DataProvider(); for (i = 0; i < totalRows; i++) { dp.addItem({col1:getRandomNumber(), col2:getRandomNumber(), col3:getRandomNumber(), col4:getRandomNumber()}); } var c1:DataGridColumn = new DataGridColumn("col1"); c1.sortOptions = Array.NUMERIC; var c2:DataGridColumn = new DataGridColumn("col2"); c2.sortOptions = Array.NUMERIC; var c3:DataGridColumn = new DataGridColumn("col3"); c3.sortOptions = Array.NUMERIC; var dg:DataGrid = new DataGrid(); dg.addColumn(c1); dg.addColumn(c2); dg.addColumn(c3); dg.dataProvider = dp; dg.labelFunction = currencyFormatter; dg.move(10, 10); dg.setSize(200, 300); addChild(dg); function getRandomNumber():Number { return Math.random() * 100; } function currencyFormatter(data:Object, column:DataGridColumn):String { return "$" + data[column.dataField].toFixed(2); }
minColumnWidth | property |
minColumnWidth:Number
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the minimum width of a DataGrid column, in pixels.
If this value is set to NaN
, the minimum column
width can be individually set for each column of the DataGrid component.
The default value is NaN.
Implementation
public function get minColumnWidth():Number
public function set minColumnWidth(value:Number):void
Example ( How to use this example )
import fl.controls.DataGrid; import fl.controls.ScrollPolicy; import fl.data.DataProvider; var i:uint; var totalRows:uint = 42; var dp:DataProvider = new DataProvider(); for (i = 0; i < totalRows; i++) { dp.addItem({col1:getString(), col2:getString(), col3:getString(), col4:getString(), col5:getString(), col6:getString(), col7:getString()}); } var dg:DataGrid = new DataGrid(); dg.setSize(450,300); dg.addColumn("col1"); dg.addColumn("col2"); dg.addColumn("col3"); dg.addColumn("col4"); dg.addColumn("col5"); dg.addColumn("col6"); dg.addColumn("col7"); dg.dataProvider = dp; dg.horizontalScrollPolicy = ScrollPolicy.ON; dg.minColumnWidth = 185; addChild(dg); function getString():String { return "This string requires a wide column"; }
resizableColumns | property |
public var resizableColumns:Boolean = true
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Indicates whether the user can change the size of the
columns. A value of true
indicates that the user can
change the column size; a value of false
indicates that
column size is fixed.
If this value is true
, the user can stretch or shrink
the columns of the DataGrid component by dragging the grid lines between
the header cells. Additionally, if this value is true
,
the user can change the size of the columns unless the resizeable
properties of individual columns are set to false
.
The default value is true.
Related API Elements
Example ( How to use this example )
resizableColumns
and sortableColumns
to false
:
import fl.controls.DataGrid; import fl.controls.dataGridClasses.DataGridColumn; var nameCol:DataGridColumn = new DataGridColumn("name"); nameCol.headerText = "NAME:"; nameCol.width = 120; var valueCol:DataGridColumn = new DataGridColumn("value"); valueCol.headerText = "VALUE:"; valueCol.width = 80; var myDataGrid:DataGrid = new DataGrid(); myDataGrid.addColumn(nameCol); myDataGrid.addColumn(valueCol); myDataGrid.addItem({name:"Name A", value:"Value A"}); myDataGrid.addItem({name:"Name B", value:"Value B"}); myDataGrid.addItem({name:"Name C", value:"Value C"}); myDataGrid.resizableColumns = false; myDataGrid.sortableColumns = false; myDataGrid.width = 200; myDataGrid.rowCount = myDataGrid.length; myDataGrid.move(10, 10); addChild(myDataGrid);
rowCount | property |
rowCount:uint
[override] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the number of rows that are at least partially visible in the list.
Implementation
override public function get rowCount():uint
override public function set rowCount(value:uint):void
Related API Elements
Example ( How to use this example )
rowCount
property:
import fl.controls.DataGrid; import fl.data.DataProvider; var dp:DataProvider = new DataProvider(); dp.addItem({col1:"item 1.A", col2:"item 1.B", col3:"item 1.C"}); dp.addItem({col1:"item 2.A", col2:"item 2.B", col3:"item 2.C"}); dp.addItem({col1:"item 3.A", col2:"item 3.B", col3:"item 3.C"}); dp.addItem({col1:"item 4.A", col2:"item 4.B", col3:"item 4.C"}); var myDataGrid:DataGrid = new DataGrid(); myDataGrid.addColumn("col1"); myDataGrid.addColumn("col2"); myDataGrid.addColumn("col3"); myDataGrid.dataProvider = dp; myDataGrid.move(10, 10); myDataGrid.setSize(300, 200); addChild(myDataGrid); var fixedHeight:uint = Math.min(myDataGrid.rowCount, myDataGrid.length); myDataGrid.rowCount = fixedHeight; trace(myDataGrid.width, myDataGrid.height); // 300 105
rowHeight | property |
rowHeight:Number
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the height of each row in the DataGrid component, in pixels.
The default value is 20.
Implementation
public function get rowHeight():Number
public function set rowHeight(value:Number):void
Related API Elements
Example ( How to use this example )
import fl.controls.DataGrid; import fl.controls.dataGridClasses.DataGridColumn; import fl.data.DataProvider; import fl.managers.StyleManager; var dp:DataProvider = new DataProvider(); var totalEntries:uint = 42; var i:uint; for(i = 0; i < totalEntries; i++) { dp.addItem( { col1:Math.random(), col2:Math.random(), col3:Math.random() } ); } var smallText:TextFormat = new TextFormat(); smallText.size = 9; smallText.font = "Verdana"; var dg:DataGrid = new DataGrid(); dg.columns = ["col1", "col2", "col3"]; dg.rowHeight = 14; dg.move(10, 10); dg.setSize(400, 300); dg.dataProvider = dp; dg.setStyle("textFormat", smallText); addChild(dg); StyleManager.setStyle("textFormat", smallText);
showHeaders | property |
showHeaders:Boolean
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets a Boolean value that indicates whether the DataGrid component shows column headers.
A value of true
indicates that the DataGrid component shows column headers; a value
of false
indicates that it does not.
The default value is true.
Implementation
public function get showHeaders():Boolean
public function set showHeaders(value:Boolean):void
Example ( How to use this example )
import fl.controls.DataGrid; import fl.controls.ScrollPolicy; import fl.data.DataProvider; var i:uint; var totalRows:uint = 42; var dp:DataProvider = new DataProvider(); for (i = 0; i < totalRows; i++) { dp.addItem({col1:Math.random(), col2:Math.random()}); } var dg1:DataGrid = new DataGrid(); dg1.move(10,10); dg1.setSize(200,300); dg1.dataProvider = dp; addChild(dg1); var dg2:DataGrid = new DataGrid(); dg2.move(250,10); dg2.setSize(200,300); dg2.dataProvider = dp; dg2.showHeaders = false; addChild(dg2);
sortableColumns | property |
public var sortableColumns:Boolean = true
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Indicates whether the user can sort the items in the data provider
by clicking on a column header cell. If this value is true
,
the user can sort the data provider items by clicking on a column header cell;
if this value is false
, the user cannot.
If this value is true
, to prevent an individual column
from responding to a user mouse click on a header cell, set the
sortable
property of that column to false
.
The sort field of a column is either the dataField
or
sortCompareFunction
property of the DataGridColumn component.
If the user clicks a column more than one time, the sort operation
alternates between ascending and descending order.
If both this property and the sortable
property of a
column are set to true
, the DataGrid component dispatches
a headerRelease
event after the user releases the mouse
button of the column header cell. If a call is not made to the preventDefault()
method from a handler method of the headerRelease
event,
the DataGrid component performs a sort based on the values of the dataField
or sortCompareFunction
properties.
The default value is true.
Related API Elements
Example ( How to use this example )
sortableColumns
property to false
to prevent the list from being user sortable:
import fl.controls.DataGrid; import fl.controls.dataGridClasses.DataGridColumn; import fl.data.DataProvider; import fl.events.DataGridEvent; var data:XML = <dataProvider> <data col1="Person A" col2="11.383" /> <data col1="Person B" col2="3.399" /> <data col1="Person C" col2="25.624" /> </dataProvider> var dp:DataProvider = new DataProvider(data); var c1:DataGridColumn = new DataGridColumn("col1"); var c2:DataGridColumn = new DataGridColumn("col2"); var myDataGrid:DataGrid = new DataGrid(); myDataGrid.addColumn(c1); myDataGrid.addColumn(c2); myDataGrid.dataProvider = dp; myDataGrid.move(10, 10); myDataGrid.setSize(160, 120); myDataGrid.sortableColumns = false; addChild(myDataGrid);
sortDescending | property |
sortDescending:Boolean
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets the order in which a column is sorted when
the user clicks its header. A value of true
indicates that the column is sorted in descending order; a
value of false
indicates that the column is
sorted in ascending order.
The sortDescending
property does not affect
how the sort method completes the sort operation. By default,
the sort operation involves a case-sensitive string sort.
To change this behavior, modify the sortOptions
and sortCompareFunction
properties of the DataGridColumn
class.
Note: If you query this property from an event
listener for the headerRelease
event, the property value
identifies the sort order for the previous sort operation. This
is because the next sort has not yet occurred.
The default value is false.
Implementation
public function get sortDescending():Boolean
Related API Elements
Example ( How to use this example )
headerRelease
and traces the sortDescending
, sortIndex
, and dataField
properties:
import fl.controls.DataGrid; import fl.controls.dataGridClasses.DataGridColumn; import fl.data.DataProvider; import fl.events.DataGridEvent; var dataXML:XML = <dataProvider> <data col1="Person A" col2="11.383" /> <data col1="Person B" col2="3.399" /> <data col1="Person C" col2="25.624" /> </dataProvider> var dp:DataProvider = new DataProvider(dataXML); var c1:DataGridColumn = new DataGridColumn("col1"); var c2:DataGridColumn = new DataGridColumn("col2"); c2.sortOptions = Array.NUMERIC; var myDataGrid:DataGrid = new DataGrid(); myDataGrid.addColumn(c1); myDataGrid.addColumn(c2); myDataGrid.dataProvider = dp; myDataGrid.width = 160; myDataGrid.rowCount = myDataGrid.length; myDataGrid.move(10, 10); myDataGrid.addEventListener(DataGridEvent.HEADER_RELEASE, headerReleaseHandler); addChild(myDataGrid); function headerReleaseHandler(event:DataGridEvent):void { var myDG:DataGrid = event.currentTarget as DataGrid; var whichColumn:DataGridColumn = myDG.getColumnAt(event.columnIndex); trace("sortDescending:", myDG.sortDescending); trace("sortIndex:", myDG.sortIndex); trace("dataField:", whichColumn.dataField); trace(""); }
sortIndex | property |
DataGrid | () | Constructor |
public function DataGrid()
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Creates a new DataGrid component instance.
addColumn | () | method |
public function addColumn(column:*):DataGridColumn
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Adds a column to the end of the columns
array.
Parameters
column:* — A String or a DataGridColumn object.
|
DataGridColumn — The DataGridColumn object that was added.
|
Related API Elements
Example ( How to use this example )
addColumn()
method:
import fl.controls.DataGrid; var myDataGrid:DataGrid = new DataGrid(); myDataGrid.addColumn("name"); myDataGrid.addColumn("value"); myDataGrid.addItem({name:"Name 1", value:"Value 1"}); myDataGrid.addItem({name:"Name 2", value:"Value 2"}); myDataGrid.addItem({name:"Name 3", value:"Value 3"}); myDataGrid.width = 200; myDataGrid.rowCount = myDataGrid.length; myDataGrid.move(10, 10); addChild(myDataGrid);
addColumn()
method:
import fl.controls.DataGrid; import fl.controls.dataGridClasses.DataGridColumn; var nameCol:DataGridColumn = new DataGridColumn("name"); var valueCol:DataGridColumn = new DataGridColumn("value"); var myDataGrid:DataGrid = new DataGrid(); myDataGrid.addColumn(nameCol); myDataGrid.addColumn(valueCol); myDataGrid.addItem({name:"Name 1", value:"Value 1"}); myDataGrid.addItem({name:"Name 2", value:"Value 2"}); myDataGrid.addItem({name:"Name 3", value:"Value 3"}); myDataGrid.width = 200; myDataGrid.rowCount = myDataGrid.length; myDataGrid.move(10, 10); addChild(myDataGrid);
import fl.controls.DataGrid; import fl.controls.dataGridClasses.DataGridColumn; import fl.data.DataProvider; var dp:DataProvider = new DataProvider(); dp.addItem( { stateName:"California", stateAbbreviation:"CA" } ); dp.addItem( { stateName:"New York", stateAbbreviation:"NY" } ); var dg:DataGrid = new DataGrid(); var abbreviationColumn:DataGridColumn = dg.addColumn(new DataGridColumn("stateAbbreviation")); var nameColumn:DataGridColumn = dg.addColumn("stateName"); abbreviationColumn.width = 100; nameColumn.width = 200; dg.move(10,10); dg.width = 300; dg.rowCount = 2; dg.dataProvider = dp; addChild(dg);
addColumnAt | () | method |
public function addColumnAt(column:*, index:uint):DataGridColumn
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Inserts a column at the specified index in the columns
array.
Parameters
column:* — The string or DataGridColumn object that represents the column to be inserted.
| |
index:uint — The array index that identifies the location at which the column is to be inserted.
|
DataGridColumn — The DataGridColumn object that was inserted into the array of columns.
|
Related API Elements
Example ( How to use this example )
import fl.controls.DataGrid; import fl.controls.dataGridClasses.DataGridColumn; import fl.data.DataProvider; var dp:DataProvider = new DataProvider(); dp.addItem( { stateName:"California", stateAbbreviation:"CA" } ); dp.addItem( { stateName:"New York", stateAbbreviation:"NY" } ); var dg:DataGrid = new DataGrid(); var abbreviationColumn:DataGridColumn = dg.addColumn(new DataGridColumn("stateAbbreviation")); var nameColumn:DataGridColumn = dg.addColumn("stateName"); abbreviationColumn.width = 100; nameColumn.width = 200; dg.move(10,10); dg.width = 300; dg.rowCount = 2; dg.dataProvider = dp; addChild(dg);
createItemEditor | () | method |
public function createItemEditor(colIndex:uint, rowIndex:uint):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Uses the editor specified by the itemEditor
property to
create an item editor for the item renderer at the column and row index
identified by the editedItemPosition
property.
This method sets the editor instance as the itemEditorInstance
property.
You can call this method from the event listener for the itemEditBegin
event. To create an editor from other code, set the editedItemPosition
property to generate the itemEditBegin
event.
Parameters
colIndex:uint — The column index of the item to be edited in the data provider.
| |
rowIndex:uint — The row index of the item to be edited in the data provider.
|
destroyItemEditor | () | method |
public function destroyItemEditor():void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Closes an item editor that is currently open on an item renderer. This method is
typically called from the event listener for the itemEditEnd
event,
after a call is made to the preventDefault()
method to prevent the
default event listener from executing.
editField | () | method |
public function editField(index:uint, dataField:String, data:Object):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Edits a given field or property in the DataGrid component.
Parameters
index:uint — The index of the data provider item to be edited.
| |
dataField:String — The name of the field or property in the data provider item to be edited.
| |
data:Object — The new data value.
|
Throws
RangeError — The specified index is less than 0 or greater than or equal to the
length of the data provider.
|
getCellRendererAt | () | method |
public function getCellRendererAt(row:uint, column:uint):ICellRenderer
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Get the instance of a cell renderer at the specified position in the DataGrid.
Note: This method returns null
for positions that are not visible (i.e. scrolled out of the
view).
Parameters
row:uint — A row index.
| |
column:uint — A column index.
|
ICellRenderer — The ICellRenderer object at the specified position, or
null if no cell renderer exists at that position.
|
getColumnAt | () | method |
public function getColumnAt(index:uint):DataGridColumn
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Retrieves the column that is located at the specified index of the columns
array.
Parameters
index:uint — The index of the column to be retrieved, or null
if a column is not found.
|
DataGridColumn — The DataGridColumn object that was found at the specified index.
|
Related API Elements
getColumnCount | () | method |
public function getColumnCount():uint
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Retrieves the number of columns in the DataGrid component.
Returnsuint — The number of columns contained in the DataGrid component.
|
Related API Elements
Example ( How to use this example )
columns
array and the getColumnCount()
method:
import fl.controls.DataGrid; import fl.controls.ScrollPolicy; import fl.data.DataProvider; var i:uint; var totalRows:uint = 16; var dp:DataProvider = new DataProvider(); for (i = 0; i < totalRows; i++) { dp.addItem({col1:getRandomNumber(), col2:getRandomNumber(), col3:getRandomNumber(), col4:getRandomNumber()}); } var dg:DataGrid = new DataGrid(); dg.setSize(200, 300); dg.columns = ["col1", "col2", "col3"]; dg.dataProvider = dp; addChild(dg); trace("columns.length:", dg.columns.length); // 3 trace("getColumnCount():", dg.getColumnCount()); // 3 function getRandomNumber():uint { return Math.round(Math.random() * 100); }
columnStretch
event is dispatched:
import fl.controls.DataGrid; import fl.controls.dataGridClasses.DataGridColumn; import fl.events.DataGridEvent; var nameCol:DataGridColumn = new DataGridColumn("name"); var valueCol:DataGridColumn = new DataGridColumn("value"); var myDataGrid:DataGrid = new DataGrid(); myDataGrid.addColumn(nameCol); myDataGrid.addColumn(valueCol); myDataGrid.addItem({name:"Name 1", value:"Value 1"}); myDataGrid.addItem({name:"Name 2", value:"Value 2"}); myDataGrid.addItem({name:"Name 3", value:"Value 3"}); myDataGrid.width = 200; myDataGrid.rowCount = myDataGrid.length; myDataGrid.move(10, 10); myDataGrid.addEventListener(DataGridEvent.COLUMN_STRETCH, columnStretchHandler); addChild(myDataGrid); function columnStretchHandler(event:DataGridEvent):void { var col:DataGridColumn; for each (col in myDataGrid.columns) { trace(col.dataField + ":", col.width + "px") } trace(""); }
getColumnIndex | () | method |
public function getColumnIndex(name:String):int
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Retrieves the index of the column of the specified name, or -1 if no match is found.
Parameters
name:String — The data field of the column to be located.
|
int — The index of the location at which the column of the
specified name is found.
|
Related API Elements
getStyleDefinition | () | method |
public static function getStyleDefinition():Object
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Retrieves the default style map for the current component. The style map contains
the type that is appropriate for the component, depending on the style that
the component uses. For example, the disabledTextFormat
style
contains a value of null
or a TextFormat object.
You can use these styles and call setStyle()
on the current
component. The following code overrides the default disabledTextFormat
style on the specified component:
componentInstance.setStyle("disabledTextFormat", new TextFormat());
Object — Default styles object.
|
Related API Elements
Example ( How to use this example )
import fl.controls.*; import fl.containers.*; import fl.controls.listClasses.*; import fl.controls.dataGridClasses.*; import fl.controls.progressBarClasses.*; import fl.core.UIComponent; import fl.data.DataProvider; var dp:DataProvider = new DataProvider(); dp.addItem( { label: "BaseScrollPane", data:BaseScrollPane } ); dp.addItem( { label: "Button", data:Button } ); dp.addItem( { label: "CellRenderer", data:CellRenderer } ); dp.addItem( { label: "CheckBox", data:CheckBox } ); dp.addItem( { label: "ColorPicker", data:ColorPicker } ); dp.addItem( { label: "ComboBox", data:ComboBox } ); dp.addItem( { label: "DataGrid", data:DataGrid } ); dp.addItem( { label: "HeaderRenderer", data:HeaderRenderer } ); dp.addItem( { label: "ImageCell", data:ImageCell } ); dp.addItem( { label: "IndeterminateBar",data:IndeterminateBar } ); dp.addItem( { label: "Label", data:Label } ); dp.addItem( { label: "List", data:List } ); dp.addItem( { label: "NumericStepper", data:NumericStepper } ); dp.addItem( { label: "ProgressBar", data:ProgressBar } ); dp.addItem( { label: "RadioButton", data:RadioButton } ); dp.addItem( { label: "ScrollPane", data:ScrollPane } ); dp.addItem( { label: "Slider", data:Slider } ); dp.addItem( { label: "TextArea", data:TextArea } ); dp.addItem( { label: "TextInput", data:TextInput } ); dp.addItem( { label: "TileList", data:TileList } ); dp.addItem( { label: "UILoader", data:UILoader } ); dp.addItem( { label: "UIComponent", data:UIComponent } ); var cb:ComboBox = new ComboBox(); cb.move(10,10); cb.setSize(300,25); cb.prompt = "Select a component to view its styles"; cb.rowCount = 12; cb.dataProvider = dp; cb.addEventListener(Event.CHANGE, showStyleDefinition); addChild(cb); var dg:DataGrid = new DataGrid(); dg.setSize(425,300); dg.move(10,50); dg.columns = [ new DataGridColumn("StyleName"), new DataGridColumn("DefaultValue") ]; addChild(dg); function showStyleDefinition(e:Event):void { var componentClass:Class = e.target.selectedItem.data as Class; var styles:Object = componentClass["getStyleDefinition"].call(this); trace(styles.toString()); var styleData:DataProvider = new DataProvider(); for(var i:* in styles) { trace(i + " : " + styles[i]); styleData.addItem( { StyleName:i, DefaultValue:styles[i] } ); } styleData.sortOn("StyleName"); dg.dataProvider = styleData; }
itemToCellRenderer | () | method |
override public function itemToCellRenderer(item:Object):ICellRenderer
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The DataGrid component has multiple cells for any given item, so the itemToCellRenderer
method always returns null
.
Parameters
item:Object — The item in the data provider.
|
ICellRenderer — null .
|
removeAllColumns | () | method |
public function removeAllColumns():void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Removes all columns from the DataGrid component.
Related API Elements
removeColumnAt | () | method |
public function removeColumnAt(index:uint):DataGridColumn
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Removes the column that is located at the specified index of the columns
array.
Parameters
index:uint — The index of the column to be removed.
|
DataGridColumn — The DataGridColumn object that was removed. This method returns null
if a column is not found at the specified index.
|
Related API Elements
scrollToIndex | () | method |
override public function scrollToIndex(newCaretIndex:int):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Scrolls the list to the item at the specified index. If the index is out of range, the scroll position does not change.
Parameters
newCaretIndex:int — The index location to scroll to.
|
spaceColumnsEqually | () | method |
public function spaceColumnsEqually():void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Resets the widths of the visible columns to the same size.
columnStretch | Event |
fl.events.DataGridEvent
property DataGridEvent.type =
fl.events.DataGridEvent.COLUMN_STRETCH
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched after a user expands a column horizontally.
TheDataGridEvent.COLUMN_STRETCH
constant defines the value of the type
property
of a columnStretch
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default
behavior to cancel. |
columnIndex | The zero-based index of the header column
in the columns array of the DataGrid object. |
currentTarget | The object that is actively processing the event object with an event listener. |
dataField | The name of the field or property in the data associated with the column of the item. |
itemRenderer | The header renderer for the column that was stretched. |
reason | null |
rowIndex | The zero-based index of the item in the data provider. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
Example ( How to use this example )
columnStretch
event:
import fl.controls.DataGrid; import fl.controls.dataGridClasses.DataGridColumn; import fl.data.DataProvider; import fl.events.DataGridEvent; var dp:DataProvider = new DataProvider(); dp.addItem({col1:"item 1.A", col2:"item 1.B", col3:"item 1.C"}); dp.addItem({col1:"item 2.A", col2:"item 2.B", col3:"item 2.C"}); dp.addItem({col1:"item 3.A", col2:"item 3.B", col3:"item 3.C"}); dp.addItem({col1:"item 4.A", col2:"item 4.B", col3:"item 4.C"}); var myDataGrid:DataGrid = new DataGrid(); myDataGrid.addColumn("col1"); myDataGrid.addColumn("col2"); myDataGrid.addColumn("col3"); myDataGrid.dataProvider = dp; myDataGrid.setSize(300, 200); myDataGrid.move(10, 10); myDataGrid.addEventListener(DataGridEvent.COLUMN_STRETCH, columnStretchHandler); addChild(myDataGrid); function columnStretchHandler(event:DataGridEvent):void { var dg:DataGrid = event.target as DataGrid; var column:DataGridColumn; var columnArray:Array = dg.columns; var dgColWidth:String; trace("resized column:", event.dataField); trace("columnIndex:", event.columnIndex); for each (column in columnArray) { dgColWidth = Number(column.width / dg.width * 100).toFixed(1); trace(column.dataField + ".width:", column.width + " pixels (" + dgColWidth + "%)"); } trace("----------"); }
headerRelease | Event |
fl.events.DataGridEvent
property DataGridEvent.type =
fl.events.DataGridEvent.HEADER_RELEASE
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched after the user clicks a header cell.
TheDataGridEvent.HEADER_RELEASE
constant defines the value of the type
property
of a headerRelease
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default
behavior to cancel. |
columnIndex | The zero-based index of the header column
in the columns array of the DataGrid object. |
currentTarget | The object that is actively processing the event object with an event listener. |
dataField | The name of the field or property in the data associated with the column of the item. |
itemRenderer | The header renderer that was clicked. |
reason | null |
rowIndex | -1 |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
Example ( How to use this example )
headerRelease
event:
import fl.controls.DataGrid; import fl.controls.dataGridClasses.DataGridColumn; import fl.data.DataProvider; import fl.events.DataGridEvent; var dp:DataProvider = new DataProvider(); dp.addItem({col1:"item 1.A", col2:"item 1.B", col3:"item 1.C"}); dp.addItem({col1:"item 2.A", col2:"item 2.B", col3:"item 2.C"}); dp.addItem({col1:"item 3.A", col2:"item 3.B", col3:"item 3.C"}); dp.addItem({col1:"item 4.A", col2:"item 4.B", col3:"item 4.C"}); var myDataGrid:DataGrid = new DataGrid(); myDataGrid.addColumn("col1"); myDataGrid.addColumn("col2"); myDataGrid.addColumn("col3"); myDataGrid.dataProvider = dp; myDataGrid.setSize(300, 200); myDataGrid.move(10, 10); myDataGrid.addEventListener(DataGridEvent.HEADER_RELEASE, headerReleaseHandler); addChild(myDataGrid); function headerReleaseHandler(event:DataGridEvent):void { var dg:DataGrid = event.target as DataGrid; trace("dataField:", event.dataField, "(columnIndex:" + event.columnIndex + ")"); trace("sortIndex:", dg.sortIndex); trace("sortDescending:", dg.sortDescending); trace("----------"); }
itemEditBegin | Event |
fl.events.DataGridEvent
property DataGridEvent.type =
fl.events.DataGridEvent.ITEM_EDIT_BEGIN
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched after the editedItemPosition
property is set
and the item can be edited.
DataGridEvent.ITEM_EDIT_BEGIN
constant defines the value of
the type
property of an itemEditBegin
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default
behavior to cancel. |
columnIndex | The zero-based index of the header column
in the columns array of the DataGrid object. |
currentTarget | The object that is actively processing the event object with an event listener. |
dataField | null |
itemRenderer | The item renderer for the item to be edited. |
reason | null |
rowIndex | The zero-based index of the item in the data provider. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
Related API Elements
itemEditBeginning | Event |
fl.events.DataGridEvent
property DataGridEvent.type =
fl.events.DataGridEvent.ITEM_EDIT_BEGINNING
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched after a user prepares to edit an item, for example, by releasing the mouse button over the item.
TheDataGridEvent.ITEM__EDIT_BEGINNING
constant defines the value of the
type
property of an itemEditBeginning
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default
behavior to cancel. |
columnIndex | The zero-based index of the header column
in the columns array of the DataGrid object. |
currentTarget | The object that is actively processing the event object with an event listener. |
dataField | The name of the field or property in the data associated with the column of the item. |
itemRenderer | The item renderer for the item to be edited. |
reason | null |
rowIndex | The zero-based index of the item in the data provider. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
Related API Elements
itemEditEnd | Event |
fl.events.DataGridEvent
property DataGridEvent.type =
fl.events.DataGridEvent.ITEM_EDIT_END
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched when an item editing session ends for any reason.
TheDataGridEvent.ITEM_EDIT_END
constant defines the value of the type
property of an itemEditEnd
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default
behavior to cancel. |
columnIndex | The zero-based index of the header column
in the columns array of the DataGrid object. |
currentTarget | The object that is actively processing the event object with an event listener. |
dataField | The name of the field or property in the data associated with the column of the item. |
itemRenderer | The item renderer for the item to be edited. |
reason | A constant defining the reason for the event. The
value must be a member of the DataGridEventReason class. |
rowIndex | The zero-based index of the item in the data provider. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
Related API Elements
itemFocusIn | Event |
fl.events.DataGridEvent
property DataGridEvent.type =
fl.events.DataGridEvent.ITEM_FOCUS_IN
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched after an item receives focus.
TheDataGridEvent.ITEM_FOCUS_IN
constant defines the value of the type
property of a itemFocusIn
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default
behavior to cancel. |
columnIndex | The zero-based index of the header column
in the columns array of the DataGrid object. |
currentTarget | The object that is actively processing the event object with an event listener. |
dataField | null |
itemRenderer | The item renderer for the item to be edited. |
reason | null |
rowIndex | The zero-based index of the item in the data provider. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
Related API Elements
itemFocusOut | Event |
fl.events.DataGridEvent
property DataGridEvent.type =
fl.events.DataGridEvent.ITEM_FOCUS_OUT
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched after an item loses focus.
TheDataGridEvent.ITEM_FOCUS_OUT
constant defines the value of the type
property of an itemFocusOut
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default
behavior to cancel. |
columnIndex | The zero-based index of the header column
in the columns array of the DataGrid object. |
currentTarget | The object that is actively processing the event object with an event listener. |
dataField | null |
itemRenderer | The item renderer for the item to be edited. |
reason | null |
rowIndex | The zero-based index of the item in the data provider. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
Related API Elements
- Add the DataGrid component to the library.
- Save this code as DataGridExample.as in the same directory as your FLA.
- Set the DocumentClass in the FLA to DataGridExample.
package { import flash.display.Sprite; import flash.events.Event; import flash.text.TextField; import fl.controls.DataGrid; public class DataGridExample extends Sprite { var sampleItem1:Object = { Name:"John Alpha", Number:"555-123-0101", Email:"jalpha@fictitious.com" }; var sampleItem2:Object = { Name:"Mary Bravo", Number:"555-372-3322", Email:"mbravo@fictitious.com" }; var sampleItem3:Object = { Name:"Trevor Gamma", Number:"555-485-1212", Email:"tgamma@fictitious.com" }; var sampleItem4:Object = { Name:"Susan Delta", Number:"555-987-3434", Email:"sdelta@fictitious.com" }; var dg:DataGrid; var tf1:TextField; var tf2:TextField; var tf3:TextField; public function DataGridExample() { createDataGrid(); createTextFields(); } private function createDataGrid():void { dg = new DataGrid(); dg.move(10,10); dg.setSize(500,125); dg.columns = ["Name","Number","Email"]; dg.addItem(sampleItem1); dg.addItem(sampleItem2); dg.addItem(sampleItem3); dg.addItem(sampleItem4); dg.addEventListener("change",gridItemSelected); dg.minColumnWidth = dg.width / 3; addChild(dg); } private function createTextFields():void { tf1 = new TextField(); tf2 = new TextField(); tf3 = new TextField(); tf1.x = tf2.x = tf3.x = 10; tf1.autoSize = tf2.autoSize = tf3.autoSize = "left"; tf1.y = 150; tf2.y = 175; tf3.y = 200; addChild(tf1); addChild(tf2); addChild(tf3); } private function gridItemSelected(e:Event):void { tf1.text = "Name: " + e.target.selectedItem.Name; tf2.text = "Number: " + e.target.selectedItem.Number; tf3.text = "Email: " + e.target.selectedItem.Email; } } }
Mon Nov 28 2011, 06:48 AM -08:00