语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
Adobe 建议不要在使用 mobileDevice 配置文件的应用程序中使用此组件。 |
DataGrid 在可滚动网格上方显示一行列标题。网格排列为在行和列中排列的单个单元格的集合。DataGrid 控件设计为支持在大量行和列之间的平滑滚动。
Spark DataGrid 控件实现为包装 Spark Grid 控件的可更换外观的包装器。Grid 控件定义数据网格的列,以及 DataGrid 控件自身的大部分功能。
DataGrid 外观负责布置网格、列标题和滚动条。外观也配置用于呈示可视元素(用作指示器、分隔符和背景)的图形元素。DataGrid 外观也定义默认项呈示器,用于显示每个单元格的内容。请参阅文档中相应呈示器类的信息以获得受支持样式的列表。
不支持 DataGrid 项呈示器中的转换。GridItemRenderer 类已禁用了其 transitions
属性,因此对此进行设置也无效。
The <s:DataGrid>
tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:
<s:DataGrid Properties columns="null" dataProvider="null" dataTipField="null" dataTipFunction="null" editable="false" editorColumnIndex="-1" editorRowIndex="-1" imeMode="null" itemEditor="null" itemRenderer="DefaultGridItemRenderer" preserveSelection="true" requestedColumnCount="-1" requestedMaxRowCount="-1" requestedMinColumnCount="-1" requestedMinRowCount="-1" requestedRowCount="-1" requireSelection="false" resizeableColumns="true" rowHeight="Calculated default" selectedCell="null" selectedCells="empty Vector.<CellPosition>" selectedIndex="null" selectedIndices="empty Vector.<CellPosition>" selectedItem="null" selectedItems="empty Vector.<Object>" selectionMode="singleRow" showDataTips="false" sortableColumns="true" typicalItem="null" variableRowHeight="false" Styles alignmentBaseline="useDominantBaseline" baselineShift="0.0" cffHinting="horizontalStem" color="0" defaultGridItemEditor="null" digitCase="default" digitWidth="default" direction="ltr" dominantBaseline="auto" fontFamily="Arial" fontLookup="device" fontSize="12" fontStyle="normal" fontWeight="normal" justificationRule="auto" justificationStyle="auto" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" stretchCursor="cursorStretch symbol from Assets.swf" textAlign="start" textAlignLast="start" textAlpha="1" textDecoration="none" textJustify="interWord" trackingLeft="0" trackingRight="0" typographicCase="default" verticalScrollPolicy="auto" Styles for the Spark Theme alternatingRowColors="undefined" borderAlpha="1.0" borderColor="0x696969" borderVisible="true" caretColor="0x0167FF" contentBackgroundAlpha="1.0" contentBackgroundColor="0xFFFFFF" rollOverColor="0xCEDBEF" selectionColor="0xA8C6EE" symbolColor="0x000000" Styles for the Mobile Theme leading="0" letterSpacing="0" selectionColor="0xE0E0E0" symbolColor="0x000000" Events caretChange="No default" gridClick="No default" gridDoubleClick="No default" gridItemEditorSessionCancel="No default" gridItemEditorSessionSave="No default" gridItemEditorSessionStart="No default" gridItemEditorSessionStarting="No default" gridMouseDown="No default" gridMouseDrag="No default" gridMouseUp="No default" gridMouseRollOut="No default" gridMouseRollOver="No default" selectionChange="No default" selectionChanging="No default" sortChange="No default" sortChanging="No default" />
默认 MXML 属性dataProvider
相关 API 元素
spark.components.gridClasses.GridColumn
spark.skins.spark.DataGridSkin
spark.skins.spark.DefaultGridItemRenderer
属性 | 由以下参数定义 | ||
---|---|---|---|
accessibilityDescription : String
一个方便的存取器,用于访问此 UIComponent 的 accessibilityProperties 对象的 description 属性。 | UIComponent | ||
accessibilityEnabled : Boolean
一个方便的存取器,用于访问此 UIComponent 的 accessibilityProperties 对象的 silent 属性。 | UIComponent | ||
accessibilityImplementation : AccessibilityImplementation
InteractiveObject 实例的当前辅助功能实现 (AccessibilityImplementation)。 | InteractiveObject | ||
accessibilityName : String
一个方便的存取器,用于访问此 UIComponent 的 accessibilityProperties 对象的 name 属性。 | UIComponent | ||
accessibilityProperties : AccessibilityProperties
此显示对象的当前辅助功能选项。 | DisplayObject | ||
accessibilityShortcut : String
一个方便的存取器,用于访问此 UIComponent 的 accessibilityProperties 对象的 shortcut 属性。 | UIComponent | ||
activeEffects : Array [只读]
组件上当前播放的效果列表,如 EffectInstance 实例的 Array。 | UIComponent | ||
alpha : Number
表示指定对象的 Alpha 透明度值。 | DisplayObject | ||
automationDelegate : Object
处理自动化相关功能的委托对象。 | UIComponent | ||
automationEnabled : Boolean [只读]
如果此组件启用了自动化,则为 true;否则为 false。 | UIComponent | ||
automationName : String
可用作此对象的标识符的名称。 | UIComponent | ||
automationOwner : DisplayObjectContainer [只读]
用于自动化目的的此组件的所有者。 | UIComponent | ||
automationParent : DisplayObjectContainer [只读]
用于自动化目的的此组件的父级。 | UIComponent | ||
automationTabularData : Object [只读]
IAutomationTabularData 接口的实现,可用于检索数据。 | UIComponent | ||
automationValue : Array [只读]
此值通常对应于对象的经呈示的外观,当对象在应用中以可视方式显示时,此值使标识符与该对象相关联。 | UIComponent | ||
automationVisible : Boolean [只读]
如果此组件对于自动化是可见的,则为 true;否则为 false。 | UIComponent | ||
baseline : Object
对于组件,此布局约束属性是基于类似命名的样式的外观。 | UIComponent | ||
baselinePosition : Number [覆盖] [只读]
组件第一行文本的基线的 y 坐标。 | SkinnableComponent | ||
blendMode : String
BlendMode 类中的一个值,用于指定要使用的混合模式。 | DisplayObject | ||
blendShader : Shader [只写]
设置用于混合前景和背景的着色器。 | DisplayObject | ||
bottom : Object
对于组件,此布局约束属性是基于类似命名的样式的外观。 | UIComponent | ||
buttonMode : Boolean
指定此 sprite 的按钮模式。 | Sprite | ||
cacheAsBitmap : Boolean
如果设置为 true,则 Flash 运行时将缓存显示对象的内部位图表示形式。 | DisplayObject | ||
cacheAsBitmapMatrix : Matrix
如果为非 null,则 Matrix 对象会定义显示对象在 cacheAsBitmap 设置为 true 时的呈现方式。 | DisplayObject | ||
cacheHeuristic : Boolean [只写]
供 Flex 使用,表示建议为对象实施位图缓存。 | UIComponent | ||
cachePolicy : String
指定此对象的位图缓存策略。 | UIComponent | ||
className : String [只读]
此实例的类的名称,如“Button”。 | UIComponent | ||
columns : IList
由该网格显示的 GridColumn 对象列表。 | DataGrid | ||
columnsLength : int [只读]
如果列 IList 已指定,将返回 columns.length 值,否则为 0。 | DataGrid | ||
constructor : Object
对类对象或给定对象实例的构造函数的引用。 | Object | ||
contentMouseX : Number [只读]
返回鼠标在内容坐标系中的 x 位置。 | UIComponent | ||
contentMouseY : Number [只读]
返回内容坐标系中鼠标的 y 位置。 | UIComponent | ||
contextMenu : NativeMenu
指定与此对象相关联的上下文菜单。 | InteractiveObject | ||
currentState : String
组件的当前视图状态。 | UIComponent | ||
cursorManager : ICursorManager [只读]
获取控制此组件及其同级组件的光标的 CursorManager。 | UIComponent | ||
dataProvider : IList
与网格中的行对应的数据项的列表。 | DataGrid | ||
dataProviderLength : int [只读]
如果 dataProvider IList 已指定,将返回 dataProvider.length 值,否则为 0。 | DataGrid | ||
dataTipField : String
数据提供程序中显示为数据提示的字段名称。 | DataGrid | ||
dataTipFunction : Function
指定在数据提供程序每个项目上运行的回调函数,以确定其数据提示。 | DataGrid | ||
defaultButton : IFlexDisplayObject
指定为容器的默认按钮的 Button 控件。 | SkinnableContainerBase | ||
depth : Number
确定容器内各项目的呈示顺序。 | UIComponent | ||
descriptor : UIComponentDescriptor
引用 UIComponentDescriptor(如果有),过去曾通过 createComponentFromDescriptor() 方法使用它来创建此 UIComponent 实例。 | UIComponent | ||
designLayer : DesignLayer
指定与该可视元素关联的可选 DesignLayer 实例。 | UIComponent | ||
document : Object
引用与此 UIComponent 相关联的文档对象。 | UIComponent | ||
doubleClickEnabled : Boolean [覆盖]
指定 UIComponent 对象是否接收 doubleClick 事件。 | UIComponent | ||
dropTarget : DisplayObject [只读]
指定拖动 sprite 时经过的显示对象,或放置 sprite 的显示对象。 | Sprite | ||
editable : Boolean
GridColumn editable 属性的默认值,指示是否可以编辑对应单元格的数据提供程序项。 | DataGrid | ||
editorColumnIndex : int [只读]
正在编辑的单元格的从零开始的列索引。 | DataGrid | ||
editorRowIndex : int [只读]
正在编辑的单元格的从零开始的行索引。 | DataGrid | ||
enabled : Boolean
组件是否可以接受用户交互。 | UIComponent | ||
enableIME : Boolean [只读]
一个标志,用于指示当组件获得焦点时是否应启用 IME。 | DataGrid | ||
errorString : String
当验证程序监视组件并且验证失败时,组件的错误提示中将显示的文本。 | UIComponent | ||
explicitHeight : Number
指定该组件在组件坐标中显式高度(以像素为单位)的数字。 | UIComponent | ||
explicitMaxHeight : Number
布局过程中父级要考虑的组件最大建议高度。 | UIComponent | ||
explicitMaxWidth : Number
布局过程中父级要考虑的组件最大建议宽度。 | UIComponent | ||
explicitMinHeight : Number
布局过程中父级要考虑的组件最小建议高度。 | UIComponent | ||
explicitMinWidth : Number
布局过程中父级要考虑的组件最小建议宽度。 | UIComponent | ||
explicitWidth : Number
指定该组件在组件坐标中显式宽度(以像素为单位)的数字。 | UIComponent | ||
filters : Array
包含当前与显示对象关联的每个滤镜对象的索引数组。 | DisplayObject | ||
flexContextMenu : IFlexContextMenu
此 UIComponent 的上下文菜单。 | UIComponent | ||
focusEnabled : Boolean
指示切换到此组件时,是否可以获得焦点。 | UIComponent | ||
focusManager : IFocusManager
获取控制此组件及其同级组件的焦点的 FocusManager。 | UIComponent | ||
focusPane : Sprite
与此对象相关联的焦点窗格。 | UIComponent | ||
focusRect : Object
指定此对象是否显示焦点矩形。 | InteractiveObject | ||
graphics : Graphics [只读]
指定属于此 sprite 的 Graphics 对象,在此 sprite 中可执行矢量绘图命令。 | Sprite | ||
hasFocusableChildren : Boolean
一个标志,指示子对象是否能够获得焦点。 | UIComponent | ||
hasLayoutMatrix3D : Boolean [只读]
如果元素具有 3D 矩阵,则为 true。 | UIComponent | ||
height : Number [覆盖]
指定组件在父坐标中的高度的数字(以像素为单位)。 | UIComponent | ||
hitArea : Sprite
指定一个 sprite 用作另一个 sprite 的点击区域。 | Sprite | ||
horizontalCenter : Object
对于组件,此布局约束属性是基于类似命名的样式的外观。 | UIComponent | ||
id : String
组件 ID。 | UIComponent | ||
imeMode : String
GridColumn imeMode 属性的默认值,用于指定 IME(输入法编辑器)模式。 | DataGrid | ||
includeInLayout : Boolean
指定此组件是否包含在父容器的布局中。 | UIComponent | ||
inheritingStyles : Object
此组件的继承样式链的开头内容。 | UIComponent | ||
initialized : Boolean
一个标志,用于确定某个对象是否已通过布局的所有三个阶段:提交、测量和布局(假设每个阶段都是必需的)。 | UIComponent | ||
instanceIndex : int [只读]
重复组件的索引。 | UIComponent | ||
instanceIndices : Array
一个 Array,包含从此 UIComponent 对象的父文档引用该对象所需的索引。 | UIComponent | ||
is3D : Boolean [只读]
当元素为 3D 时,则为 true。 | UIComponent | ||
isDocument : Boolean [只读]
如果此 UIComponent 实例为文档对象,则为 true。 | UIComponent | ||
isPopUp : Boolean
PopUpManager 将其设置为 true 以指示已弹出该组件。 | UIComponent | ||
itemEditor : IFactory
GridColumn itemEditor 属性的默认值,用于指定创建项编辑器实例所用的 IGridItemEditor 类。 | DataGrid | ||
itemEditorInstance : IGridItemEditor [只读]
对项目编辑器的当前活动实例(如果有)的引用。 | DataGrid | ||
itemRenderer : IFactory
项呈示器,用于不指定项呈示器的列。 | DataGrid | ||
layoutMatrix3D : Matrix3D [只写]
用于相对于其同级组件计算组件的布局的转换矩阵。 | UIComponent | ||
left : Object
对于组件,此布局约束属性是基于类似命名的样式的外观。 | UIComponent | ||
loaderInfo : LoaderInfo [只读]
返回一个 LoaderInfo 对象,其中包含加载此显示对象所属的文件的相关信息。 | DisplayObject | ||
maintainProjectionCenter : Boolean
如果为 true,则该组件将使其投影矩阵在其边框的中央保持居中。 | UIComponent | ||
mask : DisplayObject
调用显示对象被指定的 mask 对象遮罩。 | DisplayObject | ||
maxHeight : Number
布局过程中父级要考虑的组件最大建议高度。 | UIComponent | ||
maxWidth : Number
布局过程中父级要考虑的组件最大建议宽度。 | UIComponent | ||
measuredHeight : Number
组件的默认高度(以像素为单位)。 | UIComponent | ||
measuredMinHeight : Number
组件的默认最小高度(以像素为单位)。 | UIComponent | ||
measuredMinWidth : Number
组件的默认最小宽度(以像素为单位)。 | UIComponent | ||
measuredWidth : Number
组件的默认宽度(以像素为单位)。 | UIComponent | ||
metaData : Object
如果元数据是通过 PlaceObject4 标记与此 DisplayObject 的实例一起存储在 SWF 文件中的,则获取 DisplayObject 实例的元数据对象。 | DisplayObject | ||
minHeight : Number
布局过程中父级要考虑的组件最小建议高度。 | UIComponent | ||
minWidth : Number
布局过程中父级要考虑的组件最小建议宽度。 | UIComponent | ||
moduleFactory : IFlexModuleFactory
模块工厂用作上下文,用于为此组件使用嵌入字体以及查找用于控制此组件样式的样式管理器。 | UIComponent | ||
mouseChildren : Boolean
确定对象的子级是否支持鼠标或用户输入设备。 | DisplayObjectContainer | ||
mouseEnabled : Boolean
指定此对象是否接收鼠标或其他用户输入、消息。 | InteractiveObject | ||
mouseFocusEnabled : Boolean
单击时是否可获得焦点。 | UIComponent | ||
mouseX : Number [只读]
表示此鼠标或用户输入设备位置的 x 坐标,以像素为单位。 | DisplayObject | ||
mouseY : Number [只读]
表示此鼠标或用户输入设备位置的 y 坐标,以像素为单位。 | DisplayObject | ||
name : String
表示 DisplayObject 的实例名称。 | DisplayObject | ||
needsSoftKeyboard : Boolean
指定当该 InteractiveObject 实例获得焦点时,是否显示虚拟键盘(显示在屏幕上的软键盘)。 | InteractiveObject | ||
nestLevel : int
此对象在所属关系层次结构中的深度。 | UIComponent | ||
nonInheritingStyles : Object
此组件的非继承样式链的开头内容。 | UIComponent | ||
numAutomationChildren : int [只读]
此容器包含的自动化子项数。 | UIComponent | ||
opaqueBackground : Object
指定显示对象是否由于具有某种背景颜色而不透明。 | DisplayObject | ||
owner : DisplayObjectContainer
此 IVisualElement 对象的所有者。 | UIComponent | ||
parent : DisplayObjectContainer [覆盖] [只读]
此组件的父容器或组件。 | UIComponent | ||
parentApplication : Object [只读]
引用包含此 UIComponent 实例的 Application 对象。 | UIComponent | ||
parentDocument : Object [只读]
引用此 UIComponent 的父文档对象。 | UIComponent | ||
percentHeight : Number
以组件父代大小百分比的方式指定组件高度。 | UIComponent | ||
percentWidth : Number
以组件父代大小百分比的方式指定组件宽度。 | UIComponent | ||
postLayoutTransformOffsets : mx.geom:TransformOffsets
定义能够应用于对象转换且在一定程度上对其父布局不可视的一组调整。 | UIComponent | ||
preserveSelection : Boolean
如果为 true,数据提供程序刷新其集合时会保留选定内容。 | DataGrid | ||
processedDescriptors : Boolean
临时或延迟子项创建操作后设置为 true,具体取决于发生对象。 | UIComponent | ||
repeater : IRepeater [只读]
对生成此 UIComponent 的父文档中 Repeater 对象的引用。 | UIComponent | ||
repeaterIndex : int [只读]
项目在生成此 UIComponent 的 Repeater 数据提供程序中的索引。 | UIComponent | ||
repeaterIndices : Array
一个 Array,包含项目在生成此 UIComponent 的父文档的 Repeater 数据提供程序中的索引。 | UIComponent | ||
repeaters : Array
一个 Array,包含对生成此 UIComponent 的父文档中 Repeater 对象的引用。 | UIComponent | ||
requestedColumnCount : int
此网格的测量宽度足以显示前面的 requestedColumnCount 个列。 | DataGrid | ||
requestedMaxRowCount : int
此网格的测量高度足以显示至多 requestedMaxRowCount 个行。 | DataGrid | ||
requestedMinColumnCount : int
此网格的测量宽度足以显示至少 requestedMinColumnCount 个列。 | DataGrid | ||
requestedMinRowCount : int
此网格的测量高度足以至少显示 requestedMinRowCount 个行。 | DataGrid | ||
requestedRowCount : int
此网格的测量高度足以显示前面的 requestedRowCount 个行。 | DataGrid | ||
requireSelection : Boolean
如果为 true 且 selectionMode 属性不是 GridSelectionMode.NONE,则必须始终在网格中选中某一项。 | DataGrid | ||
resizableColumns : Boolean
指示用户能否更改列的尺寸。 | DataGrid | ||
right : Object
对于组件,此布局约束属性是基于类似命名的样式的外观。 | UIComponent | ||
root : DisplayObject [只读]
对于加载的 SWF 文件中的显示对象,root 属性是此 SWF 文件所表示的显示列表树结构部分中的顶级显示对象。 | DisplayObject | ||
rotation : Number [覆盖]
表示 DisplayObject 实例距其原始方向的旋转程度,以度为单位。 | UIComponent | ||
rotationX : Number [覆盖]
表示 DisplayObject 实例相对于 3D 父容器距离其原始方向的 x 轴旋转(以度为单位)。 | UIComponent | ||
rotationY : Number [覆盖]
表示 DisplayObject 实例相对于 3D 父容器距离其原始方向的 y 轴旋转(以度为单位)。 | UIComponent | ||
rotationZ : Number [覆盖]
表示 DisplayObject 实例相对于 3D 父容器距离其原始方向的 z 轴旋转(以度为单位)。 | UIComponent | ||
rowHeight : Number
如果 variableRowHeight 为 false,则此属性指定每行的实际高度(以像素为单位)。 | DataGrid | ||
scale9Grid : Rectangle
当前有效的缩放网格。 | DisplayObject | ||
scaleX : Number [覆盖]
用于指定水平缩放系数的数字。 | UIComponent | ||
scaleY : Number [覆盖]
用于指定垂直缩放系数的数字。 | UIComponent | ||
scaleZ : Number [覆盖]
指定沿着 z 轴的缩放因子的数值。 | UIComponent | ||
screen : Rectangle [只读]
返回包含此对象的基本绘图表面大小和位置的对象。 | UIComponent | ||
scrollRect : Rectangle
显示对象的滚动矩形范围。 | DisplayObject | ||
selectedCell : CellPosition
如果 selectionMode 是 GridSelectionMode.SINGLE_CELL 或 GridSelectionMode.MULTIPLE_CELLS,则返回第一个选定单元格(起点为 0 行 0 列),并在移动到下一行之前处理行中的每列。 | DataGrid | ||
selectedCells : Vector.<CellPosition>
如果 selectionMode 是 GridSelectionMode.SINGLE_CELL 或 GridSelectionMode.MULTIPLE_CELLS,则返回表示网格中选定单元格位置的 CellPosition 对象的 Vector。 | DataGrid | ||
selectedIndex : int
如果 selectionMode 是 GridSelectionMode.SINGLE_ROW 或 GridSelectionMode.MULTIPLE_ROWS,则返回第一个选定行的 rowIndex。 | DataGrid | ||
selectedIndices : Vector.<int>
如果 selectionMode 是 GridSelectionMode.SINGLE_ROW 或 GridSelectionMode.MULTIPLE_ROWS,则返回选定行索引的 Vector。 | DataGrid | ||
selectedItem : Object
如果 selectionMode 是 GridSelectionMode.SINGLE_ROW 或 GridSelectionMode.MULTIPLE_ROWS,则返回当前选定或 undefined(如果未选定任何行)的数据提供程序中的项。 | DataGrid | ||
selectedItems : Vector.<Object>
如果 selectionMode 是 GridSelectionMode.SINGLE_ROW 或 GridSelectionMode.MULTIPLE_ROWS,则返回当前选择的 dataProvider 项目的 Vector。 | DataGrid | ||
selectionLength : int [只读]
如果 selectionMode 为 GridSelectionMode.SINGLE_ROW 或 GridSelectionMode.MULTIPLE_ROWS,则返回所选行的数量。 | DataGrid | ||
selectionMode : String
控件的选择模式。 | DataGrid | ||
showDataTips : Boolean
如果为 true,则显示所有可见单元格的 dataTip。 | DataGrid | ||
showInAutomationHierarchy : Boolean
用于确定自动化对象是否显示在自动化层次中的标志。 | UIComponent | ||
skin : UIComponent [只读]
此组件实例的 skin 类的实例。 | SkinnableComponent | ||
softKeyboard : String
控制软键盘的外观。 | InteractiveObject | ||
softKeyboardInputAreaOfInterest : Rectangle
定义当显示软键盘时应在屏幕上保留的区域(在 iOS 上不支持)。 | InteractiveObject | ||
sortableColumns : Boolean
指定用户是否可以交互对列进行排序。 | DataGrid | ||
soundTransform : flash.media:SoundTransform
控制此 sprite 中的声音。 | Sprite | ||
stage : Stage [只读]
显示对象的舞台。 | DisplayObject | ||
states : Array
为此组件定义的视图状态。 | UIComponent | ||
styleDeclaration : CSSStyleDeclaration
存储此对象的内嵌继承样式。 | UIComponent | ||
styleManager : IStyleManager2 [只读]
返回此组件使用的 StyleManager 实例。 | UIComponent | ||
styleName : Object
此组件使用的类样式。 | UIComponent | ||
styleParent : IAdvancedStyleClient
组件的父项用于评估后代选择器。 | UIComponent | ||
suggestedFocusSkinExclusions : Array [只读]
列出捕获的位图中不包括的用于显示焦点的外观部件。 | SkinnableComponent | ||
systemManager : ISystemManager
返回此组件使用的 SystemManager 对象。 | UIComponent | ||
tabChildren : Boolean
确定对象的子项是否支持 Tab 键。 | DisplayObjectContainer | ||
tabEnabled : Boolean
指定此对象是否遵循 Tab 键顺序。 | InteractiveObject | ||
tabFocusEnabled : Boolean
一个标志,指示该对象是否能够通过 Tab 键获得焦点。这与 Flash Player 使用的 tabEnabled 属性类似。对于处理键盘输入的组件该标志通常为 true,但是控件栏中的一些组件将其设置为 false,因为它们不能像编辑器一样从另外的组件窃取焦点。 | UIComponent | ||
tabIndex : int
指定 SWF 文件中的对象按 Tab 键顺序排列。 | InteractiveObject | ||
textSnapshot : flash.text:TextSnapshot [只读]
返回此 DisplayObjectContainer 实例的 TextSnapshot 对象。 | DisplayObjectContainer | ||
toolTip : String
要在 ToolTip 中显示的文本。 | UIComponent | ||
top : Object
对于组件,此布局约束属性是基于类似命名的样式的外观。 | UIComponent | ||
transform : flash.geom:Transform [覆盖]
一个对象,具有与显示对象的矩阵、颜色转换和像素范围有关的属性。 | UIComponent | ||
transformX : Number
设置组件转换中心的 x 坐标。 | UIComponent | ||
transformY : Number
设置组件转换中心的 y 坐标。 | UIComponent | ||
transformZ : Number
设置组件转换中心的 z 坐标。 | UIComponent | ||
transitions : Array
一个 Transition 对象 Array,其中的每个 Transition 对象都定义一组效果,用于在视图状态发生更改时播放。 | UIComponent | ||
tweeningProperties : Array
当前在此对象上进行补间的属性数组。 | UIComponent | ||
typicalItem : Object
网格的布局确保未指定宽度的列足以显示此默认数据提供程序项的项呈示器。 | DataGrid | ||
uid : String
对象的唯一标识符。 | UIComponent | ||
updateCompletePendingFlag : Boolean
一个标志,确定某个对象是否已通过所有三个阶段的布局验证(假设需要通过所有验证)。 | UIComponent | ||
useHandCursor : Boolean
布尔值,表示当指针滑过 buttonMode 属性设置为 true 的 sprite 时是否显示指针手形(手形光标)。 | Sprite | ||
validationSubField : String
供验证程序用来将子字段与此组件相关联。 | UIComponent | ||
variableRowHeight : Boolean
如果为 true,则每行的高度是到目前为止显示的单元格首选高度的最大值。 | DataGrid | ||
verticalCenter : Object
对于组件,此布局约束属性是基于类似命名的样式的外观。 | UIComponent | ||
visible : Boolean [覆盖]
显示对象是否可见。 | UIComponent | ||
width : Number [覆盖]
指定组件在父坐标中的宽度的数字(以像素为单位)。 | UIComponent | ||
x : Number [覆盖]
指定组件在其父容器中的水平位置(以像素为单位)的数字。 | UIComponent | ||
y : Number [覆盖]
指定组件在其父容器中的垂直位置(以像素为单位)的数字。 | UIComponent | ||
z : Number [覆盖]
表示 DisplayObject 实例相对于 3D 父容器沿 z 轴的 z 坐标位置。 | UIComponent |
方法 | 由以下参数定义 | ||
---|---|---|---|
DataGrid()
构造函数。 | DataGrid | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
使用 EventDispatcher 对象注册事件侦听器对象,以使侦听器能够接收事件通知。 | EventDispatcher | ||
如果 selectionMode 是 GridSelectionMode.SINGLE_CELL 或 GridSelectionMode.MULTIPLE_CELLS,将单元格添加到选定内容并将尖号位置设置为该单元格。 | DataGrid | ||
如果 selectionMode 是 GridSelectionMode.MULTIPLE_ROWS,将此行添加到选定内容并将尖号位置设置为此行。 | DataGrid | ||
将非可视样式客户端添加到该组件实例。 | UIComponent | ||
表示安全限制是否会导致出现以下情况:在列表中忽略了使用指定 point 点调用 DisplayObjectContainer.getObjectsUnderPoint() 方法时返回的所有显示对象。 | DisplayObjectContainer | ||
排队稍后调用的函数。 | UIComponent | ||
如果 selectionMode 不是 GridSelectionMode.NONE,则删除所有所选行和单元格。 | DataGrid | ||
删除此组件实例的样式属性。 | UIComponent | ||
确定指定显示对象是 DisplayObjectContainer 实例的子项还是该实例本身。 | DisplayObjectContainer | ||
将 Point 对象由内容坐标转换为全局坐标。 | UIComponent | ||
将 Point 对象由内容坐标转换为本地坐标。 | UIComponent | ||
返回标识此容器中的子项的一组属性。 | UIComponent | ||
返回标识此容器中的子项的一组属性。 | UIComponent | ||
在 IUIComponent 对象的父项文档对象上创建对此对象的 id 引用。 | UIComponent | ||
在 IUIComponent 对象的父项文档对象上删除对此对象的 id 引用。 | UIComponent | ||
返回与此 UIComponent 的文本样式对应的 UITextFormat 对象。 | UIComponent | ||
[覆盖]
将事件调度到事件流中。 | UIComponent | ||
在此组件周围显示或隐藏焦点指示符。 | UIComponent | ||
drawRoundRect(x:Number, y:Number, w:Number, h:Number, r:Object = null, c:Object = null, alpha:Object = null, rot:Object = null, gradient:String = null, ratios:Array = null, hole:Object = null):void
通过编程方式在此外观的 Graphics 对象中绘制一个矩形。 | UIComponent | ||
停止在组件上播放效果实例时,由效果实例调用。 | UIComponent | ||
开始在组件上播放效果实例时,由效果实例调用。 | UIComponent | ||
结束组件上当前播放的所有效果。 | UIComponent | ||
关闭当前的活动编辑器,并(可选)通过调用项编辑器的 save() 方法保存编辑器的值。 | DataGrid | ||
如果需要,设置 verticalScrollPosition 和 horizontalScrollPosition 属性以使指定的单元格完全可见。 | DataGrid | ||
执行 UIComponent 对象是目标的所有绑定。 | UIComponent | ||
打印完成后调用。 | UIComponent | ||
在指定的索引位置提供自动化对象。 | UIComponent | ||
提供自动化对象列表。 | UIComponent | ||
返回一个矩形,该矩形定义相对于 targetCoordinateSpace 对象坐标系的显示对象区域。 | DisplayObject | ||
按指定的元素大小,返回元素边界的 x 坐标。 | UIComponent | ||
按指定的元素大小,返回元素边界的 y 坐标。 | UIComponent | ||
返回具有指定名称的子显示对象。 | DisplayObjectContainer | ||
查找此 UIComponent 实例的类型选择器。 | UIComponent | ||
返回一个约束布局值,这与获取此组件的约束样式的方式类似。 | UIComponent | ||
确定是使用显式高度还是测量高度的一种简便方法
| UIComponent | ||
确定是使用显式宽度还是测量宽度的一种简便方法
| UIComponent | ||
获取当前具有焦点的对象。 | UIComponent | ||
返回元素的布局高度。 | UIComponent | ||
返回元素的布局宽度。 | UIComponent | ||
返回元素在屏幕上进行绘制时所用的 x 坐标。 | UIComponent | ||
返回元素在屏幕上进行绘制时所用的 y 坐标。 | UIComponent | ||
返回用于相对于其同级组件计算组件的布局的转换矩阵。 | UIComponent | ||
返回此元素的布局转换 Matrix3D。 | UIComponent | ||
返回元素的最大高度。 | UIComponent | ||
返回元素的最大宽度。 | UIComponent | ||
返回元素的最小高度。 | UIComponent | ||
返回元素的最小宽度。 | UIComponent | ||
返回对象的数组,这些对象位于指定点下,并且是该 DisplayObjectContainer 实例的子项(或孙子项,依此类推)。 | DisplayObjectContainer | ||
返回元素的首选高度。 | UIComponent | ||
返回元素的首选宽度。 | UIComponent | ||
返回一个矩形,该矩形根据 targetCoordinateSpace 参数定义的坐标系定义显示对象的边界,但不包括形状上的任何笔触。 | DisplayObject | ||
返回 dataProvider 中由指定的 Repeater 用来生成此 Repeater 的项目;如果此 Repeater 未重复,则返回 null。 | UIComponent | ||
获取已在此组件的样式查找链中的某个位置设置过的样式属性。 | UIComponent | ||
将 Point 对象由全局坐标转换为内容坐标。 | UIComponent | ||
将 point 对象从舞台(全局)坐标转换为显示对象的(本地)坐标。 | DisplayObject | ||
将二维点从舞台(全局)坐标转换为三维显示对象的(本地)坐标。 | DisplayObject | ||
如果 currentCSSState 不为 null,则返回 true。 | UIComponent | ||
检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。 | EventDispatcher | ||
表示对象是否已经定义了指定的属性。 | Object | ||
确定是否已在此 UIComponent 上定义指定的状态。 | UIComponent | ||
计算显示对象的边框,以确定它是否与 obj 显示对象的边框重叠或相交。 | DisplayObject | ||
计算显示对象,以确定它是否与 x 和 y 参数指定的点重叠或相交。 | DisplayObject | ||
返回一个框 Matrix,在绘制水平渐变时可以将其作为 rot 参数传递给 drawRoundRect() 方法。 | UIComponent | ||
初始化此组件的内部结构。 | UIComponent | ||
初始化用于跟踪此组件的重复实例的各个属性。 | UIComponent | ||
如果指定的单元格可见,则它会重新显示。 | DataGrid | ||
标记组件,以便在稍后屏幕更新期间调用该组件的 updateDisplayList() 方法。 | UIComponent | ||
由某个组件的项目进行调用,以指示其 depth 属性已更改。 | UIComponent | ||
当某元素的 layoutDirection 更改或其父代的 layoutDirection 更改时,该元素必须调用该方法。 | UIComponent | ||
标记组件,以便在稍后屏幕更新期间调用该组件的 commitProperties() 方法。 | UIComponent | ||
标记组件,以便在稍后屏幕更新期间调用该组件的 measure() 方法。 | UIComponent | ||
标记组件,以在稍后的屏幕更新过程中设置外观的新状态。 | SkinnableComponent | ||
DataGrid | |||
表示 Object 类的实例是否在指定为参数的对象的原型链中。 | Object | ||
将三维显示对象的(本地)坐标的三维点转换为舞台(全局)坐标中的二维点。 | DisplayObject | ||
将 Point 对象由本地坐标转换为内容坐标。 | UIComponent | ||
将 point 对象从显示对象的(本地)坐标转换为舞台(全局)坐标。 | DisplayObject | ||
如果 cssState 与 currentCSSState 匹配,则返回 true。 | UIComponent | ||
确定此实例与给定类型相同,还是属于给定类型的子类。 | UIComponent | ||
测量指定的 HTML 文本(该文本中可能包含 <font> 和 <b> 等 HTML 标签),假定该文本显示在单行 UITextField(使用由此 UIComponent 的样式确定的 UITextFormat)中。 | UIComponent | ||
测量指定的文本,假定该文本使用由此 UIComponent 的样式确定的 UITextFormat 显示在单行 UITextField(或 UIFTETextField)中。 | UIComponent | ||
将组件移动到其父项内的指定位置。 | UIComponent | ||
将样式更改传播到子项。 | UIComponent | ||
如果 owner 属性链从 child 指向此 UIComponent,则返回 true。 | UIComponent | ||
当在父项中添加或删除 UIComponent 对象时由 Flex 调用。 | UIComponent | ||
准备 IFlexDisplayObject 用于打印。 | UIComponent | ||
表示指定的属性是否存在、是否可枚举。 | Object | ||
为此组件及其所有后代生成或重新生成 CSS 样式缓存,前提条件是递归参数为 true。 | UIComponent | ||
针对每个效果事件,将 EffectManager 注册为一个事件侦听器。 | UIComponent | ||
从 DisplayObjectContainer 实例的子级列表中删除所有子 DisplayObject 实例。 | DisplayObjectContainer | ||
从 EventDispatcher 对象中删除侦听器。 | EventDispatcher | ||
如果 selectionMode 是 GridSelectionMode.SINGLE_CELL 或 GridSelectionMode.MULTIPLE_CELLS,删除选定内容中的单元格并将插入标记位置设置为该单元格。 | DataGrid | ||
如果 selectionMode 是 GridSelectionMode.SINGLE_ROW 或 GridSelectionMode.MULTIPLE_ROWS,删除选定内容中的此行并将尖号位置设置为此行。 | DataGrid | ||
从该组件实例删除非可视样式客户端。 | UIComponent | ||
重放指定的事件。 | UIComponent | ||
显示虚拟键盘。 | InteractiveObject | ||
使用提供的 ID 解析子项。 | UIComponent | ||
[静态]
在调用 suspendBackgroundProcessing() 之后继续对使用 callLater() 排队的方法进行背景处理。 | UIComponent | ||
如果 selectionMode 是 GridSelectionMode.MULTIPLE_ROWS,选择所有行并删除尖号;如果 selectionMode 是 GridSelectionMode.MULTIPLE_CELLS,选择所有单元格并删除尖号。 | DataGrid | ||
如果 selectionMode 是 GridSelectionMode.MULTIPLE_CELLS,则将选定内容设置为单元格区域中所有单元格并将尖号位置设置为单元格区域中最后一个单元格。 | DataGrid | ||
如果 selectionMode 是 GridSelectionMode.MULTIPLE_ROWS,则将选定内容设置为指定行并将尖号位置设置为 endRowIndex。 | DataGrid | ||
如果 selectionMode 是 GridSelectionMode.SINGLE_CELL 或 GridSelectionMode.MULTIPLE_CELLS 且单元格位于当前选定内容中,则返回 true。 | DataGrid | ||
如果 selectionMode 是 GridSelectionMode.MULTIPLE_CELLS 且单元格区域中的单元格位于当前选定内容中,则返回 true。 | DataGrid | ||
如果 selectionMode 是 GridSelectionMode.SINGLE_ROW 或 GridSelectionMode.MULTIPLE_ROWS 且索引处的行位于当前选定内容中,则返回 true。 | DataGrid | ||
如果 selectionMode 是 GridSelectionMode.MULTIPLE_ROWS 且 indices 中的行位于当前选定内容中,则返回 true。 | DataGrid | ||
调整对象大小。 | UIComponent | ||
设置一个布局约束值的方式,与设置此组件的约束样式的方式相同。 | UIComponent | ||
设置当前状态。 | UIComponent | ||
设置此组件的焦点。 | UIComponent | ||
设置元素在屏幕上进行绘制时所用的坐标。 | UIComponent | ||
设置元素的布局大小。 | UIComponent | ||
设置用于相对于其同级组件计算组件的布局大小和位置的转换 Matrix。 | UIComponent | ||
设置用于计算组件相对于其同级组件的布局大小和位置的转换 Matrix3D。 | UIComponent | ||
设置循环操作动态属性的可用性。 | Object | ||
如果 selectionMode 是 GridSelectionMode.SINGLE_CELL 或 GridSelectionMode.MULTIPLE_CELLS,则将选定内容和尖号位置设置为此单元格。 | DataGrid | ||
如果 selectionMode 是 GridSelectionMode.SINGLE_ROW 或 GridSelectionMode.MULTIPLE_ROWS,则将选定内容和尖号位置设置为此行。 | DataGrid | ||
对此组件实例设置样式属性。 | UIComponent | ||
当 visible 属性发生更改时调用。 | UIComponent | ||
按照一列或多列对 DataGrid 排序,并刷新显示。 | DataGrid | ||
允许用户拖动指定的 Sprite。 | Sprite | ||
对网格中的所选单元格启动编辑器会话。 | DataGrid | ||
使用户可以在启用触摸的设备上拖动指定的 Sprite。 | Sprite | ||
对源起于此对象的所有 MovieClip 递归停止时间轴执行。 | DisplayObjectContainer | ||
结束 startDrag() 方法。 | Sprite | ||
结束 startTouchDrag() 方法,用于启用触摸的设备。 | Sprite | ||
检测对样式属性的更改。 | UIComponent | ||
首次初始化组件样式时,Flex 会调用 stylesInitialized() 方法。 | UIComponent | ||
[静态]
阻止对使用 callLater() 排队的方法进行背景处理,直到调用 resumeBackgroundProcessing() 为止。 | UIComponent | ||
返回此对象的字符串表示形式,其格式设置遵守区域设置特定的约定。 | Object | ||
[覆盖]
返回一个字符串,用于指示此对象在应用程序的 DisplayObject 层次结构中所处的位置。 | FlexSprite | ||
transformAround(transformCenter:Vector3D, scale:Vector3D = null, rotation:Vector3D = null, translation:Vector3D = null, postLayoutScale:Vector3D = null, postLayoutRotation:Vector3D = null, postLayoutTranslation:Vector3D = null, invalidateLayout:Boolean = true):void
用于更新转换的旋转、缩放和平移的一种实用程序方法,同时保留某个特定点,该点是在组件自己的坐标空间中指定的,且在父项的坐标空间中是固定的。 | UIComponent | ||
一种实用程序方法,用于将以该对象的本地坐标指定的点转换为在该对象父坐标中的相应位置。 | UIComponent | ||
验证子项的位置和大小,并绘制其他可视内容。 | UIComponent | ||
验证并更新此对象的属性和布局,如果需要的话重绘对象。 | UIComponent | ||
由布局逻辑用于通过调用 commitProperties() 方法来验证组件的属性。 | UIComponent | ||
如果使用此 ILayoutManagerClient 调用 LayoutManager.invalidateSize() 方法,随后在测量时调用了 validateSize() 方法,则验证组件的度量大小。 | UIComponent | ||
处理分配给此组件的验证程序调度的 valid 和 invalid 事件。 | UIComponent | ||
返回指定对象的原始值。 | Object | ||
返回一个框 Matrix,在绘制垂直渐变时可以将其作为 rot 参数传递给 drawRoundRect()。 | UIComponent | ||
检查是否用此 EventDispatcher 对象或其任何祖代为指定事件类型注册了事件侦听器。 | EventDispatcher |
方法 | 由以下参数定义 | ||
---|---|---|---|
调整焦点矩形。 | UIComponent | ||
提交计算的矩阵,该矩阵是基于布局矩阵以及 flash displayObject 的转换的转换偏移量而构建的。 | UIComponent | ||
这是一个内部方法,供 Flex 框架用于支持 Dissolve 效果。 | UIComponent | ||
为该组件创建外观。 | SkinnableComponent | ||
确定是否可以跳过对 measure() 方法的调用。 | UIComponent | ||
创建子对象后执行任何最终处理。 | UIComponent | ||
清除对外观部件的引用。 | SkinnableComponent | ||
更新网格的尖号位置。 | DataGrid | ||
commitInteractiveSelection(selectionEventKind:String, rowIndex:int, columnIndex:int, rowCount:int = 1, columnCount:int = 1):Boolean
为响应更改选定内容的用户输入(鼠标或键盘),该方法调度 selectionChanging 事件。 | DataGrid | ||
处理对组件设置的属性。 | UIComponent | ||
创建组件的子对象。 | UIComponent | ||
创建动态外观部件的实例。 | SkinnableComponent | ||
根据所用的嵌入字体使用上下文创建新对象。 | UIComponent | ||
使用给定的 moduleFactory 创建对象。 | UIComponent | ||
破坏和删除此组件的外观。 | SkinnableComponent | ||
更新属性时调度 PropertyChangeEvent 的 Helper 方法。 | UIComponent | ||
在 skin 类中找到外观部件并将它们指定给组件的属性。 | SkinnableComponent | ||
当 UIComponent 对象获得焦点时调用的事件处理函数。 | UIComponent | ||
当 UIComponent 对象失去焦点时调用的事件处理函数。 | UIComponent | ||
[覆盖]
返回要应用到外观的状态的名称。 | SkinnableContainerBase | ||
返回动态部件的特定实例。 | SkinnableComponent | ||
对于组件的某些不常使用的高级布局功能,初始化其实现和存储。 | UIComponent | ||
完成对此组件的初始化。 | UIComponent | ||
初始化此组件的辅助功能代码。 | UIComponent | ||
此对象影响其布局时(includeInLayout 为 true),使父代大小和显示列表失效的 Helper 方法。 | UIComponent | ||
通常由包含 UITextField 对象的组件覆盖,其中 UITextField 对象获取焦点。 | UIComponent | ||
为 keyDown 事件调用的事件处理函数。 | UIComponent | ||
为 keyUp 事件调用的事件处理函数。 | UIComponent | ||
计算组件的默认大小和(可选)默认最小大小。 | UIComponent | ||
返回动态部件的实例数目。 | SkinnableComponent | ||
添加外观部件时调用。 | SkinnableComponent | ||
正删除外观部件的实例时调用。 | SkinnableComponent | ||
删除动态部件的实例。 | SkinnableComponent | ||
构建 UIComponent 时将调用此方法,并且每当 ResourceManager 调度“change”事件用于指示本地化资源已经过某种更改时,都会再次调用此方法。 | UIComponent | ||
在水平方向和垂直方向上,指定转换拉伸因子。 | UIComponent | ||
当状态改变以检查状态特定的样式是否应用到此组件时,会调用此方法。 | UIComponent | ||
绘制对象和/或设置其子项的大小和位置。 | UIComponent |
事件 | 摘要 | 由以下参数定义 | ||
---|---|---|---|---|
[广播事件] Flash Player 或 AIR 应用程序获得操作系统焦点并变为活动状态时将调度此事件。 | EventDispatcher | |||
当组件通过使用 addChild()、addChildAt()、addElement() 或 addElementAt() 方法作为内容子项添加到容器后调度。 | UIComponent | |||
将显示对象添加到显示列表中时调度。 | DisplayObject | |||
在将显示对象直接添加到舞台显示列表或将包含显示对象的子树添加至舞台显示列表中时调度。 | DisplayObject | |||
当由于用户交互或以编程方式设置而导致插入标记位置、大小或可见性发生更改时,由网格外观部件调度。 | DataGrid | |||
当用户从文本上下文菜单中选择“清除”(或“删除”)时调度。 | InteractiveObject | |||
用户在同一 InteractiveObject 上按下并释放用户指针设备的主按钮时调度。 | InteractiveObject | |||
当用户手势触发 AIR 应用程序中与此交互式对象相关联的上下文菜单时调度。 | InteractiveObject | |||
在用户为复制操作激活特定于平台的加速键组合或从文本上下文菜单中选择“复制”时调度。 | InteractiveObject | |||
当组件完成其构建、属性处理、测量、布置和绘制时调度。 | UIComponent | |||
视图状态更改后调度。 | UIComponent | |||
在 currentState 属性更改后但视图状态更改前调度。 | UIComponent | |||
在用户为剪切操作激活特定于平台的加速键组合或从文本上下文菜单中选择“剪切”时调度。 | InteractiveObject | |||
[广播事件] Flash Player 或 AIR 应用程序失去操作系统焦点并变为非活动状态时将调度此事件。 | EventDispatcher | |||
如果 InteractiveObject 的 doubleClickEnabled 标志设置为 true,当用户在该对象上快速连续按下两次并释放指针设备的主按钮时调度。 | InteractiveObject | |||
在拖动操作完成时(将拖动的数据放到放置目标时或在没有执行放置操作的情况下结束拖放操作时)由拖动启动器(作为要拖动的数据源的组件)调度。 | UIComponent | |||
用户在放置目标上释放鼠标时由放置目标调度。 | UIComponent | |||
当用户在拖动操作过程中将鼠标移动到某个组件所处的位置时,由该组件调度。 | UIComponent | |||
用户在组件外拖动但没有将数据放置到目标时,由组件调度。 | UIComponent | |||
在拖动操作期间,当用户在鼠标位于组件上方的情况下移动鼠标时,由组件调度。 | UIComponent | |||
启动拖动操作时,由拖动启动器调度。 | UIComponent | |||
在一个效果结束后调度。 | UIComponent | |||
在即将开始播放效果前调度。 | UIComponent | |||
在停止某个效果(仅当对该效果调用 stop() 时发生)之后调度。 | UIComponent | |||
[播放事件] 播放头进入新帧时调度。 | DisplayObject | |||
在组件已进入视图状态之后调度。 | UIComponent | |||
[广播事件] 播放头退出当前帧时调度。 | DisplayObject | |||
在组件即将退出视图状态之前调度。 | UIComponent | |||
显示对象获得焦点后调度。 | InteractiveObject | |||
显示对象失去焦点后调度。 | InteractiveObject | |||
[广播事件] 在帧显示对象的构造函数运行之后但在帧脚本运行之前调度。 | DisplayObject | |||
当用户使用 InteractiveObject 实例沿触摸面边缘创建接触点时调度(如在 Siri Remote for Apple TV 上沿触摸面边缘轻击)。有些设备也可能将这种接触解释为多个触摸事件的组合。 | InteractiveObject | |||
当用户在启用触摸设备上的同一 InteractiveObject 实例上按下两个接触点时(例如,在配有触摸屏的移动电话或平板电脑上的显示对象上按下和释放两个手指)调度。 | InteractiveObject | |||
当用户在启用触摸的设备上的 InteractiveObject 实例上移动接触点时(例如,在配有触摸屏的移动电话或平板电脑上的显示对象上从左向右移动手指)调度。 | InteractiveObject | |||
当用户在接触点处使用 InteractiveObject 实例执行旋转手势时(例如,将两个手指放在屏幕上,然后在配有触摸屏的移动电话或平板电脑上的显示对象上旋转这两个手指)调度。 | InteractiveObject | |||
当用户在接触点处使用 InteractiveObject 实例执行滑动手势(例如,在配有触摸屏的移动电话或平板电脑上用三根手指触摸屏幕,然后在一个显示对象上平行移动这三根手指)时调度。 | InteractiveObject | |||
当用户使用 InteractiveObject 实例创建接触点,然后点击启用触屏的设备时(例如,将几个手指放在显示对象上以打开菜单,然后点击一个手指在配有触摸屏的移动电话或平板电脑上选择一个菜单项)调度。 | InteractiveObject | |||
当用户在接触点处使用 InteractiveObject 实例执行缩放手势操作时(例如,将两个手指放在屏幕上,然后在配有触摸屏的移动电话或平板电脑上的显示对象上快速分开手指)调度。 | InteractiveObject | |||
在单元格上单击鼠标时由 grid 外观部件调度。 | DataGrid | |||
在单元格上双击鼠标时由网格外观部件调度。 | DataGrid | |||
在不保存数据的情况下关闭项编辑器之后调度。 | DataGrid | |||
在项编辑器中的数据已保存到数据提供程序中,并且编辑器已经关闭之后调度。 | DataGrid | |||
在项编辑器打开之后立即调度。 | DataGrid | |||
在请求新的项编辑器会话时调度。 | DataGrid | |||
在网格单元格上按下鼠标按钮时由 grid 外观部件调度。 | DataGrid | |||
如果在释放按钮之前移动鼠标,则在 gridMouseDown 事件后由 grid 外观部件调度。 | DataGrid | |||
释放鼠标按钮时,在 gridMouseDown 事件后由网格外观部件调度,即使鼠标不再位于 grid 中。 | DataGrid | |||
在鼠标离开网格单元格时由网格外观部件调度。 | DataGrid | |||
在鼠标指向网格单元格时由网格外观部件调度。 | DataGrid | |||
当对象的状态从可见变为不可见时调度。 | UIComponent | |||
此事件被调度到任何支持使用 IME 进行内联输入的客户端应用程序 | InteractiveObject | |||
当组件完成构建并设置了所有初始化属性后调度。 | UIComponent | |||
当组件由 Validator 监控且未通过验证时调度。 | UIComponent | |||
用户按下某个键时调度。 | InteractiveObject | |||
用户尝试使用键盘导航更改焦点时调度。 | InteractiveObject | |||
用户释放某个键时调度。 | InteractiveObject | |||
当用户在同一 InteractiveObject 上按下并释放用户指针设备的中间按钮时调度。 | InteractiveObject | |||
当用户在 InteractiveObject 实例上按下指针设备的中间按钮时调度。 | InteractiveObject | |||
当用户在 InteractiveObject 实例上释放指针设备按钮时调度。 | InteractiveObject | |||
当用户在 InteractiveObject 实例上按下指针设备按钮时调度。 | InteractiveObject | |||
当用户在使用 PopUpManager 打开的某个组件外部单击时,从该组件调度。 | UIComponent | |||
用户尝试使用指针设备更改焦点时调度。 | InteractiveObject | |||
用户移动 InteractiveObject 上的指针设备时调度。 | InteractiveObject | |||
用户将指针设备从 InteractiveObject 实例上移开时调度。 | InteractiveObject | |||
用户将指针设备移动到 InteractiveObject 实例上时调度。 | InteractiveObject | |||
当用户在 InteractiveObject 实例上释放指针设备按钮时调度。 | InteractiveObject | |||
当鼠标滚轮滚动到 InteractiveObject 实例上时调度。 | InteractiveObject | |||
当用户使用鼠标滚轮滚动到使用 PopUpManager 打开的某个组件外部时,从该组件调度。 | UIComponent | |||
移动对象后调度。 | UIComponent | |||
当用户释放拖动手势时由拖动启动器 InteractiveObject 调度。 | InteractiveObject | |||
在将拖动对象放置到目标上且已通过对 DragManager.acceptDragDrop() 的调用接受该放置操作时,由目标 InteractiveObject 调度。 | InteractiveObject | |||
当拖动手势进入其边界时由 InteractiveObject 调度。 | InteractiveObject | |||
当拖动手势离开其边界时由 InteractiveObject 调度。 | InteractiveObject | |||
当拖动手势保持在其边界内时,由 InteractiveObject 持续调度。 | InteractiveObject | |||
在拖动操作开始时由在 DragManager.doDrag() 调用中指定为拖动启动器的 InteractiveObject 调度。 | InteractiveObject | |||
在拖动操作期间由在 DragManager.doDrag() 调用中指定为拖动启动器的 InteractiveObject 调度。 | InteractiveObject | |||
在用户为粘贴操作激活特定于平台的加速键组合或从文本上下文菜单中选择“粘贴”时调度。 | InteractiveObject | |||
在组件初始化序列开始时调度。 | UIComponent | |||
当用户将活动笔针放低经过屏幕的邻近检测阈值上时调度。 | InteractiveObject | |||
当用户将活动笔针抬高放在屏幕的邻近检测阈值上时调度。 | InteractiveObject | |||
当用户将活动笔针移动到屏幕上但仍保留在邻近检测阈值中时调度。 | InteractiveObject | |||
当用户直接将活动笔针从此 InteractiveObject 上移开但仍保留在屏幕的邻近检测阈值中时调度。 | InteractiveObject | |||
当用户直接将活动笔针移动到此 InteractiveObject 上但仍保留在屏幕的邻近检测阈值中时调度。 | InteractiveObject | |||
当用户从此 InteractiveObject 及其任一子项中移开而仍保留在屏幕的邻近检测阈值中时调度。 | InteractiveObject | |||
当用户将活动笔针从显示列表中子项的对象树中滑过此 InteractiveObject 时(而仍保留在屏幕的邻近检测阈值中)时调度。 | InteractiveObject | |||
在用户首先在 InteractiveObject 实例上按下按钮,然后将指针设备移离 InteractiveObject 实例,释放指针设备上的按钮时调度。 | InteractiveObject | |||
当组件通过使用 removeChild()、removeChildAt()、removeElement() 或 removeElementAt() 方法作为内容子项从容器中删除后调度。 | UIComponent | |||
将要从显示列表中删除显示对象时调度。 | DisplayObject | |||
在从显示列表中直接删除显示对象或删除包含显示对象的子树时调度。 | DisplayObject | |||
[广播事件] 将要更新和呈现显示列表时调度。 | DisplayObject | |||
在调整组件大小时调度。 | UIComponent | |||
当用户在同一 InteractiveObject 上按下并释放用户指针设备的右按钮时调度。 | InteractiveObject | |||
当用户在 InteractiveObject 实例上按下指针设备按钮时调度。 | InteractiveObject | |||
当用户在 InteractiveObject 实例上释放指针设备按钮时调度。 | InteractiveObject | |||
用户将指针设备从 InteractiveObject 实例上移开时调度。 | InteractiveObject | |||
用户将指针设备移动到 InteractiveObject 实例上时调度。 | InteractiveObject | |||
在用户为全选操作激活特定于平台的加速键组合或从文本上下文菜单中选择“全选”时调度。 | InteractiveObject | |||
在选定内容更改时调度。 | DataGrid | |||
所选内容即将更改时调度。 | DataGrid | |||
当对象的状态从不可见变为可见时调度。 | UIComponent | |||
在放开软键盘之后立即调度。 | InteractiveObject | |||
在放开软键盘之前立即调度。 | InteractiveObject | |||
在隐藏软键盘之后立即调度。 | InteractiveObject | |||
对数据提供程序的集合进行排序后进行调度。 | DataGrid | |||
对数据提供程序的集合进行排序之前进行调度。 | DataGrid | |||
在组件进入新状态且切换到该状态的状态转换动画已经播放完时调度。 | UIComponent | |||
在组件中断转换到当前状态从而切换到新状态时调度。 | UIComponent | |||
对象的 tabChildren 标志值发生更改时调度。 | InteractiveObject | |||
对象的 tabEnabled 标志发生更改时调度。 | InteractiveObject | |||
对象的 tabIndex 属性值发生更改时调度。 | InteractiveObject | |||
当用户输入一个或多个文本字符时调度。 | InteractiveObject | |||
要创建 ToolTip 时由组件调度。 | UIComponent | |||
已隐藏组件的 ToolTip 并要将其放弃时由组件调度。 | UIComponent | |||
要隐藏组件的 ToolTip 时由组件调度。 | UIComponent | |||
要显示组件的 ToolTip 时由组件调度。 | UIComponent | |||
显示组件的 ToolTip 时由组件调度。 | UIComponent | |||
用户将鼠标移动到设置了 toolTip 属性的组件上方后,由该组件调度。 | UIComponent | |||
当用户第一次触摸启用触摸的设备时(例如,用手指触摸配有触摸屏的移动电话或平板)调度。 | InteractiveObject | |||
当用户移除与启用触摸的设备的接触时(例如,将手指从配有触摸屏的移动电话或平板电脑上抬起)调度。 | InteractiveObject | |||
不可撤消事件,在组件结束响应 touch 交互用户操作时由组件调度。 | UIComponent | |||
不可撤消事件,在组件开始响应 touch 交互用户操作时由组件调度。 | UIComponent | |||
可撤消事件,在组件试图响应 touch 交互用户操作时由组件调度。 | UIComponent | |||
当用户触碰设备时进行调度,而且会连续调度,直到接触点被删除。 | InteractiveObject | |||
当用户将接触点从启用触摸的设备上的 InteractiveObject 实例移开时(例如,在配有触摸屏的移动电话或平板电脑上,将手指从一个显示对象拖到另一个显示对象)调度。 | InteractiveObject | |||
当用户在启用触摸的设备的 InteractiveObject 实例上移动接触点时(例如,在配有触摸屏的移动电话或平板电脑上,将手指从显示对象外的一点拖动到显示对象上的一点)调度。 | InteractiveObject | |||
当用户移动接触点,使其远离启用触摸的设备上的 InteractiveObject 实例时(例如,在配有触摸屏的移动电话或平板电脑上将一个手指从显示对象上的一点移动到显示对象外的一点)调度。 | InteractiveObject | |||
当用户在启用触摸的设备的 InteractiveObject 实例上移动接触点时(例如,在配有触摸屏的移动电话或平板电脑上,将手指从显示对象外的一点拖动到显示对象上的一点)调度。 | InteractiveObject | |||
当用户在启用触摸设备上的已启动接触的同一 InteractiveObject 实例上抬起接触点时(例如,在配有触摸屏的移动电话或平板的显示对象上的某一点处按下并释放手指)调度。 | InteractiveObject | |||
当调用了对象的 commitProperties()、measure() 和 updateDisplayList() 方法后调度(如果需要)。 | UIComponent | |||
当组件由 Validator 监控并且成功通过验证时调度。 | UIComponent | |||
当以编程方式或通过用户交互更改值时调度。 | UIComponent |
样式为常见样式,或与特定主题关联。如果为常见样式,则可以用于任何主题。如果样式与特定主题关联,则只有应用程序使用该主题时才能使用该样式。
样式 | 说明 | 由以下参数定义 | ||
---|---|---|---|---|
alignmentBaseline | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 指定主要基线对齐到的基线。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.alignmentBaseline。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
类型: String CSS 继承: 否 语言版本: ActionScript 3.0 产品版本: Flex 3 运行时版本: Flash9, AIR 1.1 从内容区域的上边缘到控件的基线位置的垂直距离(以像素为单位). | UIComponent | |||
baselineShift | 类型: Object CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 要偏移基线的量。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.baselineShift。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
类型: String CSS 继承: 否 语言版本: ActionScript 3.0 产品版本: Flex 3 运行时版本: Flash9, AIR 1.1 从组件底边到其父容器的内容区域底边之间的垂直距离(以像素为单位). | UIComponent | |||
cffHinting | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 用于此文本的 CFF 提示的类型。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.cffHinting。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
color | 类型: uint 格式: Color CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 文本的颜色。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.color。 对于 Mobile 主题,如果使用 StyleableTextField,请参阅 spark.components.supportClasses.StyleableTextField Style color;如果使用 StyleableStageText,则参阅 spark.components.supportClasses.StyleableStageText Style color。 默认值为 0x000000 。相关 API 元素 | DataGrid | ||
defaultDataGridItemEditor | 类型: Class CSS 继承: 否 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 要用作项编辑器的类(如果列未指定)。该样式属性能为一组 DataGrid 控件设置项编辑器,而不必单独设置每个控件。 DataGridColumn.itemEditor 属性代替该值。
默认值为 null 。 | DataGrid | ||
digitCase | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 用于此文本的数字大小写类型。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.digitCase。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
digitWidth | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 用于此文本的数字宽度类型。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.digitWidth。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
direction | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 指定文本的默认双向嵌入级别。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.direction。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
dominantBaseline | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 指定该元素的哪条基线对齐到 alignmentBaseline 以确定元素在该行上的垂直位置。
有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.dominantBaseline。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
类型: uint 格式: Color CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 3 运行时版本: Flash9, AIR 1.1 验证失败时,组件加亮部分的颜色. | UIComponent | |||
类型: Class 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 发生验证错误时,用于此组件的外观类的名称. | SkinnableComponent | |||
类型: Class CSS 继承: 否 语言版本: ActionScript 3.0 产品版本: Flex 3 运行时版本: Flash9, AIR 1.1 用于绘制焦点矩形的外观. | UIComponent | |||
fontFamily | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 要使用的字体的名称或用逗号分隔的字体名称列表。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.fontFamily。 对于 Mobile 主题,如果使用 StyleableTextField,请参阅 spark.components.supportClasses.StyleableTextField Style fontFamily;如果使用 StyleableStageText,则参阅 spark.components.supportClasses.StyleableStageText Style fontFamily。 Spark 主题的默认值为 相关 API 元素 | DataGrid | ||
fontLookup | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 要使用的字体查找。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.fontLookup。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
fontSize | 类型: Number 格式: Length CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 文本的高度,以像素为单位。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.fontSize。 对于 Mobile 主题,如果使用 StyleableTextField,请参阅 spark.components.supportClasses.StyleableTextField Style fontSize;如果使用 StyleableStageText,则参阅 spark.components.supportClasses.StyleableStageText Style fontSize。 Spark 主题的默认值为 相关 API 元素 | DataGrid | ||
fontStyle | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 确定文本是否使用斜体。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.fontStyle。 对于 Mobile 主题,如果使用 StyleableTextField,请参阅 spark.components.supportClasses.StyleableTextField Style fontStyle;如果使用 StyleableStageText,则参阅 spark.components.supportClasses.StyleableStageText Style fontStyle。 相关 API 元素 | DataGrid | ||
fontWeight | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 确定文本是否使用粗体。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.fontWeight。 对于 Mobile 主题,如果使用 StyleableTextField,请参阅 spark.components.supportClasses.StyleableTextField Style fontWeight;如果使用 StyleableStageText,则参阅 spark.components.supportClasses.StyleableStageText Style fontWeight。 相关 API 元素 | DataGrid | ||
类型: String CSS 继承: 否 语言版本: ActionScript 3.0 产品版本: Flex 3 运行时版本: Flash9, AIR 1.1 从组件内容区域的中心到组件中心的水平距离(以像素为单位). | UIComponent | |||
horizontalScrollPolicy | 类型: String CSS 继承: 否 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 指示水平滚动条显示的条件。
滚动策略影响 Scroller 外观部件的测量大小。该样式是对 Scroller 外观部件的 ScrollPolicy.AUTO 。相关 API 元素 | DataGrid | ||
类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 该组件的主要交互模式. | UIComponent | |||
justificationRule | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 用于将段落文本两端对齐的规则。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.justificationRule。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
justificationStyle | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 段落两端对齐所用的样式。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.justificationStyle。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
kerning | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 段落两端对齐所用的样式。 Spark 组件默认启用字距调整,但 MX 组件默认禁用字距调整。Spark 组件将 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.kerning。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4.1 运行时版本: Flash10, AIR 1.5 指定组件的所需布局方向. | UIComponent | |||
类型: String CSS 继承: 否 语言版本: ActionScript 3.0 产品版本: Flex 3 运行时版本: Flash9, AIR 1.1 从组件左边到其父容器的内容区域左边之间的水平距离(以像素为单位). | UIComponent | |||
ligatureLevel | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 控制可以在该文本中使用字体中定义的哪些连字。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.ligatureLevel。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
lineHeight | 类型: Object CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 文本的行距控制。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.lineHeight。
对于 Mobile 主题,它不受支持。请参阅 相关 API 元素 | DataGrid | ||
lineThrough | 类型: Boolean CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 若为 true,则应用删除线(一条穿过文本中间的直线)。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.lineThrough。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
locale | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 文本的区域设置。控制大小写转换和形状。使用标准区域设置标识符,如 Unicode Technical Standard #35 中所述。例如,"en"、"en_US" 和 "en-US" 均表示英语,"ja" 表示日语。 默认值为 undefined。此属性从祖代继承其值;如果未定义祖代,则从全局区域设置 在使用 Spark 格式化程序和全球化类时,可以将根应用程序的此样式设置为 undefined 。了解详细信息 | DataGrid | ||
renderingMode | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 仅适用于嵌入字体的用于该文本的呈示模式。 有关 Spark 主题,请参阅flashx.textLayout.formats.ITextLayoutFormat.renderingMode 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
类型: String CSS 继承: 否 语言版本: ActionScript 3.0 产品版本: Flex 3 运行时版本: Flash9, AIR 1.1 从组件右边到其父容器的内容区域右边之间的水平距离(以像素为单位). | UIComponent | |||
类型: Boolean CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 1.5 当此组件无效时,显示错误边框或外观 | UIComponent | |||
类型: Boolean CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 1.5 如果此组件无效,当用户将鼠标移到它上方时,将显示错误提示 | UIComponent | |||
类型: Class 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 用于此组件的 skin 类的名称. | SkinnableComponent | |||
stretchCursor | 类型: Class CSS 继承: 否 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 用作指示可调整列大小的光标外观的类。默认值为 Assets.swf 文件中的 cursorStretch 元件。
| DataGrid | ||
textAlign | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 容器内文本的对齐方式。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.textAlign。 对于 Mobile 主题,如果使用 StyleableTextField,请参阅 spark.components.supportClasses.StyleableTextField Style textAlign;如果使用 StyleableStageText,则参阅 spark.components.supportClasses.StyleableStageText Style textAlign。 相关 API 元素 | DataGrid | ||
textAlignLast | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 两端对齐文本中段落最后一行与容器的对齐方式。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.textAlignLast。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
textAlpha | 类型: Number CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 文本的 Alpha(透明度)值。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.textAlpha。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
textDecoration | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 确定文本是否加下划线。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.textDecoration。 对于 Mobile 主题,如果使用 StyleableTextField,请参阅 spark.components.supportClasses.StyleableTextField Style textDecoration;如果使用 StyleableStageText,则不支持此项。 相关 API 元素 | DataGrid | ||
textJustify | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 指定文本两端对齐的选项。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.textJustify。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
类型: String CSS 继承: 否 语言版本: ActionScript 3.0 产品版本: Flex 3 运行时版本: Flash9, AIR 1.1 从组件顶边到其父容器的内容区域顶边之间的垂直距离(以像素为单位). | UIComponent | |||
trackingLeft | 类型: Object CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 要应用于每个字符左侧的间距量(手动字距调整)。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.trackingLeft。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
trackingRight | 类型: Object CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 要应用于每个字符右侧的间距量(手动字距调整)。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.trackingRight。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
typographicCase | 类型: String CSS 继承: 是 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 用于此文本的印刷大小写的类型。 有关 Spark 主题,请参阅 flashx.textLayout.formats.ITextLayoutFormat.typographicCase。 对于 Mobile 主题,它不受支持。 相关 API 元素 | DataGrid | ||
类型: String CSS 继承: 否 语言版本: ActionScript 3.0 产品版本: Flex 3 运行时版本: Flash9, AIR 1.1 从组件内容区域的中心到组件中心的垂直距离(以像素为单位). | UIComponent | |||
verticalScrollPolicy | 类型: String CSS 继承: 否 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 指示在哪些条件下会显示垂直滑动条。
滚动策略影响 Scroller 外观部件的测量大小。该样式是对 Scroller 外观部件的 ScrollPolicy.AUTO 。相关 API 元素 | DataGrid |
样式 | 说明 | 由以下参数定义 | ||
---|---|---|---|---|
alternatingRowColors | 类型: Array 格式: Color CSS 继承: 否 主题: spark 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 用于初始化 DataGrid 的 rowBackground 外观部件。如果指定 alternatingRowColors 样式,则将 alternatingRowColorsBackground 外观部件用作 rowBackground 外观部件的值。网格行的交变颜色由该样式的 Array 值中的连续条目定义。
如果您要更改该样式呈示的方式,请替换 DataGridSkin 类中的 undefined 。 | DataGrid | ||
borderAlpha | 类型: Number CSS 继承: 否 主题: spark 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 此组件的边框的 Alpha 值。有效值为 0.0 到 1.0。 默认值为 1.0 。 | DataGrid | ||
borderColor | 类型: uint 格式: Color CSS 继承: 否 主题: spark 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 此组件的边框的颜色。 默认值为 #696969 。 | DataGrid | ||
borderVisible | 类型: Boolean CSS 继承: 否 主题: spark 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 控制此组件的边框的可见性。 默认值为 true 。 | DataGrid | ||
caretColor | 类型: uint 格式: Color CSS 继承: 是 主题: spark 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.0 导航 Grid 时插入标记指示符的颜色。 默认值为 0x0167FF 。 | DataGrid | ||
类型: uint 格式: Color CSS 继承: 是 主题: spark, mobile 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 组件的主要颜色. | SkinnableComponent | |||
contentBackgroundAlpha | 类型: Number CSS 继承: 是 主题: spark 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 组件内容背景的 Alpha。有效值为 0.0 到 1.0。 | DataGrid | ||
contentBackgroundColor | 类型: uint 格式: Color CSS 继承: 是 主题: spark 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 此组件内容背景的颜色。 对于 List,更改 Spark 主题的默认值为 | DataGrid | ||
rollOverColor | 类型: uint 格式: Color CSS 继承: 是 主题: spark 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.0 鼠标位于组件上时加亮的颜色。 该样式只能应用在鼠标 0xCEDBEF 。 | DataGrid | ||
selectionColor | 类型: uint 格式: Color CSS 继承: 是 主题: spark, mobile 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.0 用户选中呈示器时其背景的颜色。 Halo 主题的默认值为 | DataGrid | ||
symbolColor | 类型: uint 格式: Color CSS 继承: 是 主题: spark, mobile 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.0 组件的任何元件的颜色。示例包括 CheckBox 的复选标记或滚动按钮的箭头. 默认值为 0x000000 。 | DataGrid |
样式 | 说明 | 由以下参数定义 | ||
---|---|---|---|---|
类型: uint 格式: Color CSS 继承: 是 主题: spark, mobile 语言版本: ActionScript 3.0 产品版本: Flex 4 运行时版本: Flash10, AIR 1.5 组件的主要颜色. | SkinnableComponent | |||
leading | 类型: Number 格式: Length CSS 继承: 是 主题: mobile 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10.1, AIR 2.0 文本行之间附加的垂直空间。
对于 Spark 主题,它不受支持。请参阅 对于 Mobile 主题,如果使用 StyleableTextField,请参阅 spark.components.supportClasses.StyleableStageText Style fontWeight;如果使用 StyleableStageText,则不支持此项。 相关 API 元素 | DataGrid | ||
letterSpacing | 类型: Number CSS 继承: 是 主题: mobile 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10.1, AIR 2.0 各字符之间显示的附加像素数。
对于 Spark 主题,它不受支持。请参阅 对于 Mobile 主题,如果使用 StyleableTextField,请参阅 spark.components.supportClasses.StyleableTextField.letterSpacing;如果使用 StyleableStageText,则不支持此项。 相关 API 元素 | DataGrid | ||
selectionColor | 类型: uint 格式: Color CSS 继承: 是 主题: spark, mobile 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.0 用户选中呈示器时其背景的颜色。 Halo 主题的默认值为 | DataGrid | ||
symbolColor | 类型: uint 格式: Color CSS 继承: 是 主题: spark, mobile 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.0 组件的任何元件的颜色。示例包括 CheckBox 的复选标记或滚动按钮的箭头. 默认值为 0x000000 。 | DataGrid |
此组件使用的外观是由外观部件组成的。请勿直接设置外观部件。组件的外观会对外观部件进行设置。
外观部件 | 说明 | 由以下参数定义 | ||
---|---|---|---|---|
alternatingRowColorsBackground:IFactory | 必需: false 部件类型: 动态 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 用于呈示 alternatingRowColors 样式的 IVisualElement 类。 IFactory 必须返回类型对象。 IVisualElement。 | DataGrid | ||
caretIndicator:IFactory | 必需: false 部件类型: 动态 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 用于呈示网格的插入标记指示符的 IVisualElement 类。 IFactory 必须返回类型对象。 IVisualElement。 | DataGrid | ||
columnHeaderGroup:GridColumnHeaderGroup | 必需: false 部件类型: 静态 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 对显示列标题的 GridColumnHeaderGroup 对象的引用。 | DataGrid | ||
columnSeparator:IFactory | 必需: false 部件类型: 动态 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 用于呈示列之间的垂直分隔符的 IVisualElement 类。 IFactory 必须返回类型对象。 IVisualElement。 | DataGrid | ||
editorIndicator:IFactory | 必需: false 部件类型: 动态 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 用于在正在编辑的项呈示器后面呈示背景的 IVisualElement 类。仅当数据网格和列都是可编辑的,且列将 rendererIsEditable 设置为 true 时,才对项呈示器进行编辑。 IFactory 必须返回类型对象。 IVisualElement。 | DataGrid | ||
grid:Grid | 必需: false 部件类型: 静态 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 对显示行和列的 Grid 控件的引用。 | DataGrid | ||
hoverIndicator:IFactory | 必需: false 部件类型: 动态 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 用于提供悬浮提示反馈的 IVisualElement 类。 IFactory 必须返回类型对象。 IVisualElement。 | DataGrid | ||
rowBackground:IFactory | 必需: false 部件类型: 动态 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 用于呈示每一行的背景的 IVisualElement 类。 IFactory 必须返回类型对象。 IVisualElement。 | DataGrid | ||
rowSeparator:IFactory | 必需: false 部件类型: 动态 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 用于呈示标题行之间的水平分隔符的 IVisualElement 类。 IFactory 必须返回类型对象。 IVisualElement。 | DataGrid | ||
scroller:Scroller | 必需: false 部件类型: 静态 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 对将滚动条添加到 DataGrid 控件的外观类中的 Scroller 控件的引用。 | DataGrid | ||
selectionIndicator:IFactory | 必需: false 部件类型: 动态 语言版本: ActionScript 3.0 产品版本: Flex 4.5 运行时版本: Flash10, AIR 2.5 用于呈示所选行或单元格的 IVisualElement 类。 IFactory 必须返回类型对象。 IVisualElement。 | DataGrid |
要设置组件外观,请实现定义以下状态的外观。尽管必须实现所有外观状态,但外观状态可以为空。空外观状态表示对默认外观状态不作任何更改。
columns | 属性 |
columns:IList
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
由该网格显示的 GridColumn 对象列表。每列选择要显示的不同数据提供程序项属性。
GridColumn 对象仅可以显示在单个 Grid 控件的 columns
中。
默认值为 null。
此属性可用作数据绑定的源。修改此属性后,将调度 columnsChanged
事件。
实现
public function get columns():IList
public function set columns(value:IList):void
columnsLength | 属性 |
dataProvider | 属性 |
dataProviderLength | 属性 |
dataTipField | 属性 |
dataTipField:String
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
数据提供程序中显示为数据提示的字段名称。默认情况下,如果 showDataTips
为 true
,则关联的网格控件在每个数据提供程序项中查找名为 label
的属性并进行显示。然而,如果数据提供程序不包含 label
属性,则可以设置 dataTipField
属性以指定其它属性名称。例如,在用户查看数据库中包含的一组用户名时,可以将值设置为“FullName”。
GridColumn.dataTipField
的优先级比此属性高。
如果此列或其网格指定了 dataTipFunction
属性的值,则忽略 dataTipField
属性。
默认值为 null。
此属性可用作数据绑定的源。修改此属性后,将调度 dataTipFieldChanged
事件。
实现
public function get dataTipField():String
public function set dataTipField(value:String):void
dataTipFunction | 属性 |
dataTipFunction:Function
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
指定在数据提供程序每个项目上运行的回调函数,以确定其数据提示。此属性由 itemToDataTip
方法使用。
默认情况下,如果 showDataTips
为 true
,则该列在每个数据提供程序项中查找名为 label
的属性,并将其显示为它的数据提示。不过,某些数据提供程序没有 label
属性,也没有其它可用于显示行中数据的属性。
例如,您具有包含 lastName 和 firstName 字段的数据提供程序,但您希望将全名显示为数据提示。可以为 dataTipFunction
属性指定一个函数,该函数返回包含这两个字段值的单个 String。还可以使用 dataTipFunction
属性来处理格式和本地化。
dataTipFunction
函数的签名必须与以下内容相匹配:
dataTipFunction(item:Object, column:GridColumn):String
item
参数为整个行的数据提供程序项。第二个参数是此列对象。
典型的函数可能连接项的 firstName 和 lastName 属性,或对 Date 值属性设置某种自定义格式。
默认值为 null。
此属性可用作数据绑定的源。修改此属性后,将调度 dataTipFunctionChanged
事件。
实现
public function get dataTipFunction():Function
public function set dataTipFunction(value:Function):void
editable | 属性 |
editable:Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
GridColumn editable
属性的默认值,指示是否可以编辑对应单元格的数据提供程序项。如果为 true
,单击所选单元格将打开项编辑器。您可以通过处理 startItemEditorSession
事件来启用或禁用编辑每个单元格(而不是每个列)。在事件处理函数中,添加所需逻辑以确定单元格是否可编辑。
默认值为 false。
实现
public function get editable():Boolean
public function set editable(value:Boolean):void
editorColumnIndex | 属性 |
editorRowIndex | 属性 |
enableIME | 属性 |
imeMode | 属性 |
imeMode:String
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
GridColumn imeMode
属性的默认值,用于指定 IME(输入法编辑器)模式。IME 使用户能够用中文、日文和韩文输入文本。Flex 在该控件获得焦点时设置指定的 IME 模式,并在该控件丢失焦点时将其设置回先前的值。
flash.system.IMEConversionMode 类定义此属性的有效值的常量。您还可以指定 null
不指定任何 IME 模式。
默认值为 null。
实现
public function get imeMode():String
public function set imeMode(value:String):void
相关 API 元素
itemEditor | 属性 |
itemEditor:IFactory
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
GridColumn itemEditor
属性的默认值,用于指定创建项编辑器实例所用的 IGridItemEditor 类。
默认值为 null.。
此属性可用作数据绑定的源。修改此属性后,将调度 itemEditorChanged
事件。
实现
public function get itemEditor():IFactory
public function set itemEditor(value:IFactory):void
相关 API 元素
itemEditorInstance | 属性 |
itemEditorInstance:IGridItemEditor
[只读] 语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
对项目编辑器的当前活动实例(如果有)的引用。
若要在编辑项目时访问项目编辑器实例和新项目值,则应使用 itemEditorInstance
属性。在调度 itemEditorSessionStart
事件之前,itemEditorInstance
属性无效。
DataGridColumn.itemEditor
属性定义项目编辑器的类,从而定义项目编辑器实例的数据类型。
不要在 MXML 中设置此属性。
实现
public function get itemEditorInstance():IGridItemEditor
itemRenderer | 属性 |
preserveSelection | 属性 |
requestedColumnCount | 属性 |
requestedColumnCount:int
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
此网格的测量宽度足以显示前面的 requestedColumnCount
个列。如果 requestedColumnCount
为 -1,则测量宽度足以显示所有列。
如果已显式设置网格的实际大小,则此属性不起作用。
默认值为 -1。
实现
public function get requestedColumnCount():int
public function set requestedColumnCount(value:int):void
requestedMaxRowCount | 属性 |
requestedMaxRowCount:int
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
此网格的测量高度足以显示至多 requestedMaxRowCount
个行。
如果以下任一项为 true,则此属性无效:
- 已设置
requestedRowCount
。 - 已显式设置网格的实际大小。
默认值为 10。
实现
public function get requestedMaxRowCount():int
public function set requestedMaxRowCount(value:int):void
requestedMinColumnCount | 属性 |
requestedMinColumnCount:int
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
此网格的测量宽度足以显示至少 requestedMinColumnCount
个列。
如果以下任一项为 true,则此属性无效:
- 已设置
requestedColumnCount
。 - 已显式设置网格的实际大小。
- 网格位于 Scroller 组件内。
默认值为 -1。
实现
public function get requestedMinColumnCount():int
public function set requestedMinColumnCount(value:int):void
requestedMinRowCount | 属性 |
requestedMinRowCount:int
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
此网格的测量高度足以至少显示 requestedMinRowCount
个行。
如果以下任一项为 true,则此属性无效:
- 已设置
requestedRowCount
。 - 已显式设置网格的实际大小。
默认值为 -1。
实现
public function get requestedMinRowCount():int
public function set requestedMinRowCount(value:int):void
requestedRowCount | 属性 |
requestedRowCount:int
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
此网格的测量高度足以显示前面的 requestedRowCount
个行。
如果 requestedRowCount
为 -1,则测量大小足以显示所有布局元素。
如果已显式设置网格的实际大小,则此属性不起作用。
默认值为 -1。
实现
public function get requestedRowCount():int
public function set requestedRowCount(value:int):void
requireSelection | 属性 |
resizableColumns | 属性 |
resizableColumns:Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
指示用户能否更改列的尺寸。 如果为 true
,则用户可以通过在标题单元格之间拖动网格线来伸展或缩短 DataGrid 控件的列。如果为 true
,则还必须将单个列的 resizable
设置为 false
以防止用户调整特定列的大小。
默认值为 true。
此属性可用作数据绑定的源。修改此属性后,将调度 resizableColumnsChanged
事件。
实现
public function get resizableColumns():Boolean
public function set resizableColumns(value:Boolean):void
rowHeight | 属性 |
rowHeight:Number
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 variableRowHeight
为 false
,则此属性指定每行的实际高度(以像素为单位)。
如果 variableRowHeight
为 true
,将此属性的值用作尚未滚动到可视范围内的行的估计高度,而不是使用 typicalItem
配置的呈示器的首选高度。同样,当 Grid 使用空行填充其显示时,此属性指定空行的高度。
如果 variableRowHeight
为 false
,则此属性的默认值是为 typicalItem
创建的每列呈示器的最大首选高度。
此属性可用作数据绑定的源。修改此属性后,将调度 rowHeightChanged
事件。
实现
public function get rowHeight():Number
public function set rowHeight(value:Number):void
selectedCell | 属性 |
selectedCell:CellPosition
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.SINGLE_CELL
或 GridSelectionMode.MULTIPLE_CELLS
,则返回第一个选定单元格(起点为 0 行 0 列),并在移动到下一行之前处理行中的每列。
当用户通过与控件进行交互更改选定内容时,控件将调度 selectionChange
事件。当用户以编程方式更改选定内容时,控件将分派 valueCommit
事件。
此属性可用于初始化或绑定到 MXML 标记中的选择。setSelectedCell()
方法应用于程序选择更新,例如编写 keyboard 或 mouse 事件处理函数时。
默认值为 null。
此属性可用作数据绑定的源。修改此属性后,将调度 valueCommit
事件。
实现
public function get selectedCell():CellPosition
public function set selectedCell(value:CellPosition):void
selectedCells | 属性 |
selectedCells:Vector.<CellPosition>
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.SINGLE_CELL
或 GridSelectionMode.MULTIPLE_CELLS
,则返回表示网格中选定单元格位置的 CellPosition 对象的 Vector。
当用户通过与控件进行交互更改选定内容时,控件将调度 selectionChange
事件。当用户以编程方式更改选定内容时,控件将分派 valueCommit
事件。
此属性可用于初始化或绑定到 MXML 标记中的选择。setSelectedCell()
方法应用于程序选择更新,例如编写 keyboard 或 mouse 事件处理函数时。
默认值为空 Vector.<CellPosition>
此属性可用作数据绑定的源。修改此属性后,将调度 valueCommit
事件。
实现
public function get selectedCells():Vector.<CellPosition>
public function set selectedCells(value:Vector.<CellPosition>):void
selectedIndex | 属性 |
selectedIndex:int
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.SINGLE_ROW
或 GridSelectionMode.MULTIPLE_ROWS
,则返回第一个选定行的 rowIndex。
当用户通过与控件进行交互更改选定内容时,控件将调度 selectionChange
事件。当用户以编程方式更改选定内容时,控件将分派 valueCommit
事件。
此属性可用于初始化或绑定到 MXML 标记中的选择。setSelectedCell()
方法应用于程序选择更新,例如编写 keyboard 或 mouse 事件处理函数时。
默认值为 -1。
此属性可用作数据绑定的源。修改此属性后,将调度 valueCommit
事件。
实现
public function get selectedIndex():int
public function set selectedIndex(value:int):void
selectedIndices | 属性 |
selectedIndices:Vector.<int>
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.SINGLE_ROW
或 GridSelectionMode.MULTIPLE_ROWS
,则返回选定行索引的 Vector。对于所有其它选择模式,此方法不起作用。
当用户通过与控件进行交互更改选定内容时,控件将调度 selectionChange
事件。当用户以编程方式更改选定内容时,控件将分派 valueCommit
事件。
此属性可用于初始化或绑定到 MXML 标记中的选择。setSelectedCell() 方法应用于程序选择更新,例如编写 keyboard 或 mouse 事件处理函数时。
>默认值为空 Vector.<int>
此属性可用作数据绑定的源。修改此属性后,将调度 valueCommit
事件。
实现
public function get selectedIndices():Vector.<int>
public function set selectedIndices(value:Vector.<int>):void
selectedItem | 属性 |
selectedItem:Object
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.SINGLE_ROW
或 GridSelectionMode.MULTIPLE_ROWS
,则返回当前选定或 undefined
(如果未选定任何行)的数据提供程序中的项。
当用户通过与控件进行交互更改选定内容时,控件将调度 selectionChange
事件。当用户以编程方式更改选定内容时,控件将分派 valueCommit
事件。
此属性可用于初始化或绑定到 MXML 标记中的选择。setSelectedCell()
方法应用于程序选择更新,例如编写 keyboard 或 mouse 事件处理函数时。
默认值为 null。
此属性可用作数据绑定的源。修改此属性后,将调度 valueCommit
事件。
实现
public function get selectedItem():Object
public function set selectedItem(value:Object):void
selectedItems | 属性 |
selectedItems:Vector.<Object>
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.SINGLE_ROW
或 GridSelectionMode.MULTIPLE_ROWS
,则返回当前选择的 dataProvider 项目的 Vector。
当用户通过与控件进行交互更改选定内容时,控件将调度 selectionChange
事件。当用户以编程方式更改选定内容时,控件将分派 valueCommit
事件。
此属性可用于初始化或绑定到 MXML 标记中的选择。setSelectedCell() 方法应用于程序选择更新,例如编写 keyboard 或 mouse 事件处理函数时。
默认值为空 Vector.<Object>
此属性可用作数据绑定的源。修改此属性后,将调度 valueCommit
事件。
实现
public function get selectedItems():Vector.<Object>
public function set selectedItems(value:Vector.<Object>):void
selectionLength | 属性 |
selectionLength:int
[只读] 语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
为 GridSelectionMode.SINGLE_ROW
或 GridSelectionMode.MULTIPLE_ROWS
,则返回所选行的数量;如果 selectionMode
为 GridSelectionMode.SINGLE_CELLS
或 GridSelectionMode.MULTIPLE_CELLS
,则返回所选单元格的数量。
此属性可用作数据绑定的源。修改此属性后,将调度 valueCommit
事件。
实现
public function get selectionLength():int
selectionMode | 属性 |
selectionMode:String
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
控件的选择模式。可能的值是:GridSelectionMode.MULTIPLE_CELLS
、GridSelectionMode.MULTIPLE_ROWS
、GridSelectionMode.NONE
、GridSelectionMode.SINGLE_CELL
和 GridSelectionMode.SINGLE_ROW
。
更改 selectionMode 会导致清除当前选定内容,并将 caretRowIndex 和 caretColumnIndex 设置为 -1。
默认值为 GridSelectionMode.SINGLE_ROW。
此属性可用作数据绑定的源。修改此属性后,将调度 selectionModeChanged
事件。
实现
public function get selectionMode():String
public function set selectionMode(value:String):void
相关 API 元素
showDataTips | 属性 |
showDataTips:Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果为 true
,则显示所有可见单元格的 dataTip。如果为 false
(默认值),则仅当列的 showDataTips
属性为 true
时才显示 dataTip。
默认值为 false。
此属性可用作数据绑定的源。修改此属性后,将调度 showDataTipsChanged
事件。
实现
public function get showDataTips():Boolean
public function set showDataTips(value:Boolean):void
sortableColumns | 属性 |
sortableColumns:Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
指定用户是否可以交互对列进行排序。如果为 true
,用户可以通过单击列标题,按列的数据字段对数据提供程序进行排序。如果为 true
,则单个列可以将其 sortable
属性设置为 false
,以防止用户按该列排序。
默认值为 true。
此属性可用作数据绑定的源。修改此属性后,将调度 sortableColumnsChanged
事件。
实现
public function get sortableColumns():Boolean
public function set sortableColumns(value:Boolean):void
typicalItem | 属性 |
typicalItem:Object
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
网格的布局确保未指定宽度的列足以显示此默认数据提供程序项的项呈示器。如果未指定典型项,则使用第一个数据提供程序项。
限制:如果 typicalItem
是 IVisualItem,则它不能同时是数据提供程序的成员。
默认值为 null。
此属性可用作数据绑定的源。修改此属性后,将调度 typicalItemChanged
事件。
实现
public function get typicalItem():Object
public function set typicalItem(value:Object):void
variableRowHeight | 属性 |
variableRowHeight:Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果为 true
,则每行的高度是到目前为止显示的单元格首选高度的最大值。
如果为 false
,则每行的高度恰好是 rowHeight
属性的值。如果未指定 rowHeight
,则每行的高度由 typicalItem
属性定义。
默认值为 false。
此属性可用作数据绑定的源。修改此属性后,将调度 variableRowHeightChanged
事件。
实现
public function get variableRowHeight():Boolean
public function set variableRowHeight(value:Boolean):void
DataGrid | () | 构造函数 |
public function DataGrid()
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
构造函数。
addSelectedCell | () | 方法 |
public function addSelectedCell(rowIndex:int, columnIndex:int):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.SINGLE_CELL
或 GridSelectionMode.MULTIPLE_CELLS
,将单元格添加到选定内容并将尖号位置设置为该单元格。对于所有其它选择模式,此方法不起作用。
rowIndex
是包含所选单元格的项的数据提供程序中的索引。columnIndex
是包含所选单元格的列的 columns
中的索引。
参数
rowIndex:int — 单元格的从零开始的行索引。
| |
columnIndex:int — 单元格的从零开始的列索引。
|
Boolean — 如果未引发任何错误,则为 true 。如果 rowIndex 或 columnIndex 无效,或 selectionMode 无效,则为 false 。
|
addSelectedIndex | () | 方法 |
public function addSelectedIndex(rowIndex:int):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.MULTIPLE_ROWS
,将此行添加到选定内容并将尖号位置设置为此行。对于所有其它选择模式,此方法不起作用。
rowIndex
是包含所选单元格的项的数据提供程序中的索引。
参数
rowIndex:int — 单元格的从零开始的行索引。
|
Boolean — 如果未引发任何错误,则为 true 。如果 index 无效或 selectionMode 无效,则为 false 。
|
clearSelection | () | 方法 |
commitCaretPosition | () | 方法 |
protected function commitCaretPosition(newCaretRowIndex:int, newCaretColumnIndex:int):void
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
更新网格的尖号位置。如果插入标记位置更改,则 grid
外观部件调度 caretChange
事件。
参数
newCaretRowIndex:int — 新尖号位置从零开始的 rowIndex。
| |
newCaretColumnIndex:int — 新尖号位置从零开始的 columnIndex。如果 selectionMode 基于行,则为 -1。
|
相关 API 元素
commitInteractiveSelection | () | 方法 |
protected function commitInteractiveSelection(selectionEventKind:String, rowIndex:int, columnIndex:int, rowCount:int = 1, columnCount:int = 1):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
为响应更改选定内容的用户输入(鼠标或键盘),该方法调度 selectionChanging
事件。如果不取消该事件,则会提交选定内容更改,并调度 selectionChange
事件。不更新插入标记位置。要检测插入标记是否已更改,请使用 caretChanged
事件。
参数
selectionEventKind:String — 由用于指定正在提交的选定内容的 GridSelectionEventKind 类定义的常量。如果不为 null,则用于生成 selectionChanging 事件。
| |
rowIndex:int — 如果 selectionEventKind 适用于一行或一个单元格,则返回数据提供程序中选定内容从零开始的 rowIndex 。如果 selectionEventKind 适用于多个单元格,则返回单元格区域的原点从零开始的 rowIndex 。默认值为 -1,表示此参数未被使用。
| |
columnIndex:int — 如果 selectionEventKind 适用于单行或单个单元格,则返回选定内容从零开始的 columnIndex 。如果 selectionEventKind 适用于多个单元格,则返回单元格区域的原点从零开始的 columnIndex 。默认值为 -1,表示此参数未被使用。
| |
rowCount:int (default = 1 ) — 如果 selectionEventKind 适用于一个单元格区域,则返回单元格区域中的行数。默认值为 -1,表示此参数未被使用。
| |
columnCount:int (default = 1 ) — 如果 selectionEventKind 适用于一个单元格区域,则返回单元格区域中的列数。默认值为 -1,表示此参数未被使用。
|
Boolean — 如果选定内容已提交或未发生更改,则为 true ,如果选定内容已取消或由于出错无法提交(如索引超出范围或 selectionEventKind 与 selectionMode 不兼容),则为 false 。
|
相关 API 元素
endItemEditorSession | () | 方法 |
public function endItemEditorSession(cancel:Boolean = false):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
关闭当前的活动编辑器,并(可选)通过调用项编辑器的 save()
方法保存编辑器的值。如果 cancel
参数为 true
,将改为调用编辑器的 cancel()
方法。
参数
cancel:Boolean (default = false ) — 如果为 false ,则保存编辑器中的数据。否则,将废弃编辑器中的数据。
|
Boolean — 如果编辑器会话已保存,则为 true ;如果保存被取消,则为 false 。
|
ensureCellIsVisible | () | 方法 |
public function ensureCellIsVisible(rowIndex:int, columnIndex:int = -1):void
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果需要,设置 verticalScrollPosition
和 horizontalScrollPosition
属性以使指定的单元格完全可见。如果 rowIndex
为 -1,且指定了 columnIndex
,则只需调整 horizontalScrollPosition
以使指定的列可见。如果 columnIndex
为 -1,且指定了 rowIndex
,则只需调整 verticalScrollPosition
以使指定的行可见。
参数
rowIndex:int — 项呈示器的单元格的从零开始的行索引,或 -1 以指定一列。
| |
columnIndex:int (default = -1 ) — 项呈示器的单元格的从零开始的列索引,或 -1 以指定一行。
|
invalidateCell | () | 方法 |
public function invalidateCell(rowIndex:int, columnIndex:int):void
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果指定的单元格可见,则它会重新显示。如果 variableRowHeight=true
,则执行此操作可能会导致对应行的高度发生更改。
如果 columnIndex 为 -1,则整个行无效。同样,如果 rowIndex 为 -1
,则整个列无效。
当对位于 rowIndex
处的数据提供程序项的任何方面所做的更改可能会影响指定单元格的显示方式时,应调用该方法。调用该方法与调用 dataProvider.itemUpdated()
方法类似,后者建议 Grid 显示指定项的所有行应重新显示。使用此方法可以相对提高效率,因为它将更改的范围缩小到单个单元格。
参数
rowIndex:int — 发生更改的单元格的从零开始的行索引,或为 -1。
| |
columnIndex:int — 发生更改的单元格的从零开始的列索引,或为 -1。
|
invalidateTypicalItem | () | 方法 |
public function invalidateTypicalItem():void
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 1.5 |
removeSelectedCell | () | 方法 |
public function removeSelectedCell(rowIndex:int, columnIndex:int):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.SINGLE_CELL
或 GridSelectionMode.MULTIPLE_CELLS
,删除选定内容中的单元格并将尖号位置设置为该单元格。对于所有其它选择模式,此方法不起作用。
rowIndex
是包含所选单元格的项的数据提供程序中的索引。columnIndex
是包含所选单元格的列的 columns
中的索引。
参数
rowIndex:int — 单元格的从零开始的行索引。
| |
columnIndex:int — 单元格的从零开始的列索引。
|
Boolean — 如果未引发任何错误,则为 true 。如果 rowIndex 或 columnIndex 无效,或 selectionMode 无效,则为 false 。
|
removeSelectedIndex | () | 方法 |
public function removeSelectedIndex(rowIndex:int):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.SINGLE_ROW
或 GridSelectionMode.MULTIPLE_ROWS
,删除选定内容中的此行并将尖号位置设置为此行。对于所有其它选择模式,此方法不起作用。
rowIndex
是包含所选单元格的项的数据提供程序中的索引。
参数
rowIndex:int — 单元格的从零开始的行索引。
|
Boolean — 如果未引发任何错误,则为 true 。如果 index 无效或 selectionMode 无效,则为 false 。
|
selectAll | () | 方法 |
public function selectAll():Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.MULTIPLE_ROWS
,选择所有行并删除插入标记;如果 selectionMode
是 GridSelectionMode.MULTIPLE_CELLS
,选择所有单元格并删除插入标记。对于所有其它选择模式,此方法不起作用。
如果调用此方法后向 dataProvider
添加项目或添加了 columns
,将选择新的行或新列中的单元格。
发生以下任一情况时该隐式“全选”模式将结束:
- 使用
clearSelection
清除选定内容 - 使用
setSelectedCell
、setSelectedCells
、setSelectedIndex
或selectIndices
之一重置选定内容 dataProvider
已刷新且preserveSelection
为 falsedataProvider
已重置columns
已刷新,preserveSelection
为false
且selectionMode
为GridSelectionMode.MULTIPLE_CELLS
columns
已重置且selectionMode
为GridSelectionMode.MULTIPLE_CELLS
Boolean — 如果选定内容发生更改,则为 true 。
|
selectCellRegion | () | 方法 |
public function selectCellRegion(rowIndex:int, columnIndex:int, rowCount:uint, columnCount:uint):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.MULTIPLE_CELLS
,则将选定内容设置为单元格区域中的所有单元格并将尖号位置设置为单元格区域中的最后一个单元格。对于所有其它选择模式,此方法不起作用。
rowIndex
是包含单元格区域的原点的项的数据提供程序中的索引。columnIndex
是包含单元格区域的原点的列的 columns
中的索引。
如果单元格区域没有完全包含在网格中,此方法不起作用。
参数
rowIndex:int — 单元格区域原点的从零开始的行索引。
| |
columnIndex:int — 单元格区域原点的从零开始的列索引。
| |
rowCount:uint — 要包含在单元格区域中的行数,从 rowIndex 开始。
| |
columnCount:uint — 要包含在单元格区域中的列数,从 columnIndex 开始。
|
Boolean — 如果未引发任何错误,则为 true 。如果单元格区域无效或 selectionMode 无效,则为 false 。
|
selectIndices | () | 方法 |
public function selectIndices(rowIndex:int, rowCount:int):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.MULTIPLE_ROWS
,则将选定内容设置为指定行并将尖号位置设置为 endRowIndex
。对于所有其它选择模式,此方法不起作用。
每个索引表示要包含在选定内容中的数据提供程序中的一项。
参数
rowIndex:int — 选定内容中第一行的从零开始的行索引。
| |
rowCount:int — 选定内容中的行数。
|
Boolean — 如果未引发任何错误,则为 true 。如果所有索引都无效或 startRowIndex 大于 endRowIndex 或 selectionMode 无效,则为 false 。
|
selectionContainsCell | () | 方法 |
public function selectionContainsCell(rowIndex:int, columnIndex:int):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.SINGLE_CELL
或 GridSelectionMode.MULTIPLE_CELLS
且单元格位于当前选定内容中,则返回 true
。
rowIndex
必须介于 0 和数据提供程序的长度之间。columnIndex
必须介于 0 和 columns
的长度之间。
参数
rowIndex:int — 单元格的从零开始的行索引。
| |
columnIndex:int — 单元格的从零开始的列索引。
|
Boolean — 如果当前选定内容包含单元格,则返回 true 。
|
selectionContainsCellRegion | () | 方法 |
public function selectionContainsCellRegion(rowIndex:int, columnIndex:int, rowCount:int, columnCount:int):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.MULTIPLE_CELLS
且单元格区域中的单元格位于当前选定内容中,则返回 true
。
rowIndex
必须介于 0 和数据提供程序的长度之间。columnIndex
必须介于 0 和 columns
的长度之间。
参数
rowIndex:int — 单元格的从零开始的行索引。
| |
columnIndex:int — 单元格的从零开始的列索引。
| |
rowCount:int — 要包含在单元格区域中的行数,从 rowIndex 开始。
| |
columnCount:int — 要包含在单元格区域中的列数,从 columnIndex 开始。
|
Boolean — 如果当前选定内容包含单元格区域中的所有单元格,则返回 true 。
|
selectionContainsIndex | () | 方法 |
public function selectionContainsIndex(rowIndex:int):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.SINGLE_ROW
或 GridSelectionMode.MULTIPLE_ROWS
且 index
处的行位于当前选定内容中,则返回 true
。
rowIndex
是包含所选单元格的项的数据提供程序中的索引。
参数
rowIndex:int — 行的从零开始的行索引。
|
Boolean — 如果选定内容包含此行,则返回 true 。
|
selectionContainsIndices | () | 方法 |
public function selectionContainsIndices(rowIndices:Vector.<int>):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.MULTIPLE_ROWS
且 indices
中的行位于当前选定内容中,则返回 true
。
参数
rowIndices:Vector.<int> — 要包含在选定内容中的从零开始的行索引的矢量。
|
Boolean — 如果当前选定内容包含这些行,则返回 true 。
|
setSelectedCell | () | 方法 |
public function setSelectedCell(rowIndex:int, columnIndex:int):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.SINGLE_CELL
或 GridSelectionMode.MULTIPLE_CELLS
,则将选定内容和尖号位置设置为此单元格。对于所有其它选择模式,此方法不起作用。
rowIndex
是包含所选单元格的项的数据提供程序中的索引。columnIndex
是包含所选单元格的列的 columns
中的索引。
参数
rowIndex:int — 单元格的从零开始的行索引。
| |
columnIndex:int — 单元格的从零开始的列索引。
|
Boolean — 如果未引发任何错误,则为 true 。如果 rowIndex 或 columnIndex 无效,或 selectionMode 无效,则为 false 。
|
setSelectedIndex | () | 方法 |
public function setSelectedIndex(rowIndex:int):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果 selectionMode
是 GridSelectionMode.SINGLE_ROW
或 GridSelectionMode.MULTIPLE_ROWS
,则将选定内容和尖号位置设置为此行。对于所有其它选择模式,此方法不起作用。
rowIndex
是包含所选单元格的项的数据提供程序中的索引。
参数
rowIndex:int — 单元格的从零开始的行索引。
|
Boolean — 如果未引发任何错误,则为 true 。如果 index 无效,或 selectionMode 无效,则为 false 。
|
sortByColumns | () | 方法 |
public function sortByColumns(columnIndices:Vector.<int>, isInteractive:Boolean = false):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
按照一列或多列对 DataGrid 排序,并刷新显示。
如果 dataProvider
为 ICollectionView,则其 sort
属性会设置为某一个值,具体取决于每个列的 dataField
、sortCompareFunction
和 sortDescending
标志。然后,会调用数据提供程序的 refresh()
方法。
如果 dataProvider
不为 ICollectionView,则该方法不起作用。
参数
columnIndices:Vector.<int> — 对 dataProvider 进行排序所依据的列索引。
| |
isInteractive:Boolean (default = false ) — 如果为 true,将分派 GridSortEvent.SORT_CHANGING 和 GridSortEvent.SORT_CHANGE 事件,且列标题组 visibleSortIndicatorIndices 将更新为 columnIndices (如果 GridSortEvent.SORT_CHANGING 事件尚未取消)。
|
Boolean — 如果已使用提供的列索引对 dataProvider 进行排序,则为 true 。
|
相关 API 元素
spark.components.gridClasses.GridColumn.sortCompareFunction
spark.components.gridClasses.GridColumn.sortDescending
spark.components.gridClasses.GridColumn.sortField
spark.components.gridClasses.GridColumnHeaderGroup.visibleSortIndicatorIndices
spark.events.GridSortEvent
startItemEditorSession | () | 方法 |
public function startItemEditorSession(rowIndex:int, columnIndex:int):Boolean
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
对网格中的所选单元格启动编辑器会话。此方法不检查 DataGrid 和 GridColumn 的 editable 属性,该属性可防止用户界面启动编辑器会话。startItemEditorSession
事件在创建项编辑器之前调度。这样会允许侦听器动态更改指定单元格的项编辑器。也可以调用 preventDefault()
方法来取消事件,以防止创建编辑器会话。
参数
rowIndex:int — 要编辑的单元格的从零开始的行索引。
| |
columnIndex:int — 要编辑的单元格的从零开始的列索引。
|
Boolean — 如果编辑器会话已启动,则为 true 。如果取消编辑器会话或无法启动编辑器会话,则返回 false 。请注意,无法在不可见的列中启动编辑器会话。
|
caretChange | 事件 |
spark.events.GridCaretEvent
属性 GridCaretEvent.type =
spark.events.GridCaretEvent.CARET_CHANGE
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
当由于用户交互或以编程方式设置而导致插入标记位置、大小或可见性发生更改时,由 grid
外观部件调度。
要处理该事件,请将事件处理函数指定给 DataGrid 控件的 grid
外观部件。
GridSelectionEvent.CARET_CHANGE
常量为 caretChange
事件定义事件对象的 type
属性的值,指示当前尖号位置刚刚更改。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。 |
newColumnIndex | 尖号位置更改后的从零开始的列索引。如果 selectionMode 基于行,则为 -1。 |
newRowIndex | 尖号位置更改后的从零开始的行索引。 |
oldColumnIndex | 尖号位置更改前的从零开始的列索引。如果 selectionMode 基于行,则为 -1。 |
oldRowIndex | 尖号位置更改前的从零开始的行索引。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GirdCaretEvent.CARET_CHANGE |
gridClick | 事件 |
spark.events.GridEvent
属性 GridEvent.type =
spark.events.GridEvent.GRID_CLICK
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
在单元格上单击鼠标时由 grid
外观部件调度。
要处理该事件,请将事件处理函数指定给 DataGrid 控件的 grid
外观部件。
gridClick
GridEvent 的 type
属性的值。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。 |
column | 发生事件的列;如果事件没有发生在列中,则为 null。 |
columnIndex | 发生事件的列索引;如果在网格列中没有发生事件,则为 -1。 |
grid | 与此事件关联的网格。 |
item | 此行的数据提供程序项;如果在网格行中没有发生事件,则为 null。 |
itemRenderer | 显示此单元格的项呈示器;如果在可见单元格中没有发生事件,则为 null。 |
rowIndex | 发生事件的行索引;如果在网格行中没有发生事件,则为 -1。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GirdEvent.GRID_CLICK |
gridDoubleClick | 事件 |
spark.events.GridEvent
属性 GridEvent.type =
spark.events.GridEvent.GRID_DOUBLE_CLICK
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
在单元格上双击鼠标时由 grid
外观部件调度。
要处理该事件,请将事件处理函数指定给 DataGrid 控件的 grid
外观部件。
gridDoubleClick
GridEvent 的 type
属性的值。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。 |
column | 发生事件的列;如果事件没有发生在列中,则为 null。 |
columnIndex | 发生事件的列索引;如果在网格列中没有发生事件,则为 -1。 |
grid | 与此事件关联的网格。 |
item | 此行的数据提供程序项;如果在网格行中没有发生事件,则为 null。 |
itemRenderer | 显示此单元格的项呈示器;如果在可见单元格中没有发生事件,则为 null。 |
rowIndex | 发生事件的行索引;如果在网格行中没有发生事件,则为 -1。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GirdEvent.GRID_DOUBLE_CLICK |
gridItemEditorSessionCancel | 事件 |
spark.events.GridItemEditorEvent
属性 GridItemEditorEvent.type =
spark.events.GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_CANCEL
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
在不保存数据的情况下关闭项编辑器之后调度。
GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_CANCEL
常量为 cancelridItemEditor
事件定义事件对象的 type
属性的值。在不保存数据的情况下关闭项编辑器之后调度。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。 |
columnIndex | 已编辑但未修改的项目从零开始的列索引。 |
rowIndex | 已编辑但未修改的项目从零开始的行索引。 |
column | 已编辑的单元格列。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_CANCEL |
相关 API 元素
gridItemEditorSessionSave | 事件 |
spark.events.GridItemEditorEvent
属性 GridItemEditorEvent.type =
spark.events.GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_SAVE
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
在项编辑器中的数据已保存到数据提供程序中,并且编辑器已经关闭之后调度。
GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_SAVE
常量为 saveGridItemEditor
事件定义事件对象的 type
属性的值。在项编辑器中的数据已保存到数据提供程序中,并且编辑器已经关闭之后调度。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。 |
columnIndex | 已修改的项目从零开始的列索引。 |
rowIndex | 已修改的项目从零开始的行索引。 |
column | 已编辑的单元格列。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_SAVE |
相关 API 元素
gridItemEditorSessionStart | 事件 |
spark.events.GridItemEditorEvent
属性 GridItemEditorEvent.type =
spark.events.GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_START
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
在项编辑器打开之后立即调度。
GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_START
常量为 openGridItemEditor
事件定义事件对象的 type
属性的值。在项编辑器打开之后立即调度。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。 |
columnIndex | 项编辑器从零开始的列索引。 |
rowIndex | 项编辑器从零开始的行索引。 |
column | 正在编辑的单元格列。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_START |
相关 API 元素
gridItemEditorSessionStarting | 事件 |
spark.events.GridItemEditorEvent
属性 GridItemEditorEvent.type =
spark.events.GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_STARTING
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
在请求新的项编辑器会话时调度。侦听器可以动态确定单元格是否可编辑,如果单元格不可编辑,则(通过调用 preventDefault()
方法)取消编辑。侦听器也可动态更改所使用的编辑器,方法是将其它项编辑器指定给列。
如果取消该事件,则不会创建项编辑器。
GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_STARTING
常量为 startGridItemEditorSession
事件定义事件对象的 type
属性的值。在请求新的项编辑器会话时调度。侦听器可以动态确定单元格是否可编辑,如果单元格不可编辑,则通过调用 preventDefault()
方法取消编辑。侦听器也可以动态更改所使用的编辑器,方法是将其它项编辑器指定给网格列。
如果取消该事件,则不会创建项编辑器。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | true |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。 |
columnIndex | 请求的项编辑器从零开始的列索引。 |
rowIndex | 请求的项编辑器从零开始的行索引。 |
column | 与编辑请求相关联的单元格列。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GridItemEditorEvent.GRID_ITEM_EDITOR_SESSION_STARTING |
相关 API 元素
flash.events.Event
gridMouseDown | 事件 |
spark.events.GridEvent
属性 GridEvent.type =
spark.events.GridEvent.GRID_MOUSE_DOWN
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
在网格单元格上按下鼠标按钮时由 grid
外观部件调度。
要处理该事件,请将事件处理函数指定给 DataGrid 控件的 grid
外观部件。
gridMouseDown
GridEvent 的 type
属性的值。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。 |
column | 发生事件的列;如果事件没有发生在列中,则为 null。 |
columnIndex | 发生事件的列索引;如果在网格列中没有发生事件,则为 -1。 |
grid | 与此事件关联的网格。 |
item | 此行的数据提供程序项;如果在网格行中没有发生事件,则为 null。 |
itemRenderer | 显示此单元格的项呈示器;如果在可见单元格中没有发生事件,则为 null。 |
rowIndex | 发生事件的行索引;如果在网格行中没有发生事件,则为 -1。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GirdEvent.GRID_MOUSE_DOWN |
gridMouseDrag | 事件 |
spark.events.GridEvent
属性 GridEvent.type =
spark.events.GridEvent.GRID_MOUSE_DRAG
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
如果在释放按钮之前移动鼠标,则在 gridMouseDown
事件后由 grid
外观部件调度。
要处理该事件,请将事件处理函数指定给 DataGrid 控件的 grid
外观部件。
gridMouseDrag
GridEvent 的 type
属性的值。仅当侦听器处理完 mouseDown
事件,然后按住按钮的同时移动鼠标时,才会调度此事件。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。 |
column | 发生事件的列;如果事件没有发生在列中,则为 null。 |
columnIndex | 发生事件的列索引;如果在网格列中没有发生事件,则为 -1。 |
grid | 与此事件关联的网格。 |
item | 此行的数据提供程序项;如果在网格行中没有发生事件,则为 null。 |
itemRenderer | 显示此单元格的项呈示器;如果在可见单元格中没有发生事件,则为 null。 |
rowIndex | 发生事件的行索引;如果在网格行中没有发生事件,则为 -1。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GirdEvent.GRID_MOUSE_DRAG |
gridMouseUp | 事件 |
spark.events.GridEvent
属性 GridEvent.type =
spark.events.GridEvent.GRID_MOUSE_UP
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
释放鼠标按钮时,在 gridMouseDown
事件后由网格外观部件调度,即使鼠标不再位于 grid
中。
要处理该事件,请将事件处理函数指定给 DataGrid 控件的 grid
外观部件。
gridMouseUp
GridEvent 的 type
属性的值。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。 |
column | 发生事件的列;如果事件没有发生在列中,则为 null。 |
columnIndex | 发生事件的列索引;如果在网格列中没有发生事件,则为 -1。 |
grid | 与此事件关联的网格。 |
item | 此行的数据提供程序项;如果在网格行中没有发生事件,则为 null。 |
itemRenderer | 显示此单元格的项呈示器;如果在可见单元格中没有发生事件,则为 null。 |
rowIndex | 发生事件的行索引;如果在网格行中没有发生事件,则为 -1。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GirdEvent.GRID_MOUSE_UP |
gridRollOut | 事件 |
spark.events.GridEvent
属性 GridEvent.type =
spark.events.GridEvent.GRID_ROLL_OUT
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
在鼠标离开网格单元格时由 grid
外观部件调度。
要处理该事件,请将事件处理函数指定给 DataGrid 控件的 grid
外观部件。
gridRollOut
GridEvent 的 type
属性的值。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。 |
column | 发生事件的列;如果事件没有发生在列中,则为 null。 |
columnIndex | 发生事件的列索引;如果在网格列中没有发生事件,则为 -1。 |
grid | 与此事件关联的网格。 |
item | 此行的数据提供程序项;如果在网格行中没有发生事件,则为 null。 |
itemRenderer | 显示此单元格的项呈示器;如果在可见单元格中没有发生事件,则为 null。 |
rowIndex | 发生事件的行索引;如果在网格行中没有发生事件,则为 -1。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GirdEvent.GRID_ROLL_OUT |
gridRollOver | 事件 |
spark.events.GridEvent
属性 GridEvent.type =
spark.events.GridEvent.GRID_ROLL_OVER
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
在鼠标指向网格单元格时由 grid
外观部件调度。
要处理该事件,请将事件处理函数指定给 DataGrid 控件的 grid
外观部件。
gridRollOver
GridEvent 的 type
属性的值。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。 |
column | 发生事件的列;如果事件没有发生在列中,则为 null。 |
columnIndex | 发生事件的列索引;如果在网格列中没有发生事件,则为 -1。 |
grid | 与此事件关联的网格。 |
item | 此行的数据提供程序项;如果在网格行中没有发生事件,则为 null。 |
itemRenderer | 显示此单元格的项呈示器;如果在可见单元格中没有发生事件,则为 null。 |
rowIndex | 发生事件的行索引;如果在网格行中没有发生事件,则为 -1。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GirdEvent.GRID_ROLL_OVER |
selectionChange | 事件 |
spark.events.GridSelectionEvent
属性 GridSelectionEvent.type =
spark.events.GridSelectionEvent.SELECTION_CHANGE
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
在选定内容更改时调度。
当用户与此控件交互时,将调度此事件。以编程方式更改选定内容时,组件不会调度 selectionChange
事件。两种情况中任何一种情况下,它都会调度 valueCommit
事件。
GridSelectionEvent.SELECTION_CHANGE
常量为 selectionChange
事件定义事件对象的 type
属性值,指示当前选定内容刚刚更改。
当用户与此控件交互时,将调度此事件。通过编程方式对数据提供程序的集合进行排序时,此组件不会调度 selectionChange
事件。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。 |
kind
| changing 事件的类型。有效值定义为 GridSelectionEventKind 类中的常量。此值确定使用事件中的哪些属性。 |
selectionChange | 由用户操作触发的刚刚完成的选定内容更改。使用 DataGrid 选择方法确定当前选定内容。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GridSelectionEvent.SELECTION_CHANGE |
selectionChanging | 事件 |
spark.events.GridSelectionEvent
属性 GridSelectionEvent.type =
spark.events.GridSelectionEvent.SELECTION_CHANGING
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
所选内容即将更改时调度。对事件调用 preventDefault()
方法可避免选择内容发生更改。
当用户与此控件交互时,将调度此事件。以编程方式更改选定内容时,组件不会调度 selectionChanging
事件。
GridSelectionEvent.SELECTION_CHANGING
常量为 selectionChanging
事件定义事件对象的 type
属性的值,指示当前选定内容将要更改。对此事件调用 preventDefault() 以防止更改选定内容。
当用户与此控件交互时,将调度此事件。通过编程方式对数据提供程序的集合进行排序时,此组件不会调度 selectionChanging
事件。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。 |
kind
| changing 事件的类型。有效值定义为 GridSelectionEventKind 类中的常量。此值确定使用事件中的哪些属性。 |
selectionChange | 由用户操作触发的后续选定内容更改。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GridSelectionEvent.SELECTION_CHANGING |
sortChange | 事件 |
spark.events.GridSortEvent
属性 GridSortEvent.type =
spark.events.GridSortEvent.SORT_CHANGE
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
对数据提供程序的集合进行排序后进行调度。通常当用户在列标题上释放鼠标按键且已对数据提供程序的集合进行排序后调度此事件。
当用户与此控件交互时,将调度此事件。通过编程方式对数据提供程序的集合进行排序时,此组件不会调度 sortChanging
事件。
GridSortEvent.SORT_CHANGE
常量为 sortChange
事件定义事件对象的 type
属性值,其指示排序过滤器已应用于网格的 dataProvider
集合。
通常,如果列标题鼠标单击触发了该排序,则 columnIndices
的上一个索引是列索引。请注意,交互式排序不需要由鼠标单击触发。
当用户与此控件交互时,将调度此事件。通过编程方式对数据提供程序的集合进行排序时,此组件不会调度 sortChange
事件。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
columnIndices | 已排序列的列索引矢量。 |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myDataGrid.addEventListener() 注册某个事件侦听器,则 myDataGrid 为 currentTarget 的值。 |
newSortFields | 此次排序的 ISortFields 数组。 |
oldSortFields | 上一次排序的 ISortFields 数组。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GridSelectionEvent.SORT_CHANGE |
sortChanging | 事件 |
spark.events.GridSortEvent
属性 GridSortEvent.type =
spark.events.GridSortEvent.SORT_CHANGING
语言版本: | ActionScript 3.0 |
产品版本: | Flex 4.5 |
运行时版本: | Flash Player 10, AIR 2.5 |
对数据提供程序的集合进行排序之前进行调度。通常当用户在列标题上释放鼠标按键以请求控件基于列内容对网格内容进行排序时调度此事件。仅在列可排序且数据提供程序支持排序时才调度。
DataGrid 控件包含针对此事件的默认处理函数(实现单列排序以及将网格的 columnHeaderGroup
中的 visibleSortIndices
更新为 columnIndices
)。
通过调用 preventDefault()
方法以防止单列排序并设置事件的 columnIndices
和 newSortFields
参数以更改默认行为可以实现多列排序。newSortFields
应设置为所需的排序字段。columnIndices
应设置为在列标题栏中应具有可见排序指示符的列的索引。
当用户与此控件交互时,将调度此事件。通过编程方式对数据提供程序的集合进行排序时,此组件不会调度 sortChanging
事件。
GridSortEvent.SORT_CHANGING
常量为 sortChanging
事件定义事件对象的 type
属性值,其指示排序过滤器将应用于网格的 dataProvider
集合。对该事件调用 preventDefault() 可防止排序发生,或者如果要更改排序的默认行为,可以修改 columnIndices
和 newSortFields
。
通常,如果列标题鼠标单击触发了该排序,则 columnIndices
的上一个索引是列索引。请注意,交互式排序不需要由鼠标单击触发。
当用户与此控件交互时,将调度此事件。通过编程方式对数据提供程序的集合进行排序时,此组件不会调度 sortChanging
事件。
事件对象的属性有下列值:
属性 | 值 |
---|---|
bubbles | false |
cancelable | false |
columnIndices | 要排序列的列索引矢量。 |
currentTarget | 用于定义处理该事件的事件侦听器的对象。例如,如果您使用 myDataGrid.addEventListener() 注册某个事件侦听器,则 myDataGrid 为 currentTarget 的值。 |
newSortFields | 此次排序的 ISortFields 数组。 |
oldSortFields | 上一次排序的 ISortFields 数组。 |
target | 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。 |
type | GridSelectionEvent.SORT_CHANGING |
<?xml version="1.0" encoding="utf-8"?> <!-- A very simple DataGrid example. The ArrayCollection is the list of dataProvider items, one per DataGrid row and the DataGrid automatically creates one column for each property in the first item. The dataProvider property tag isn't specified because it's the default property and leaving it out makes the code just a little simpler looking. Although any class that implements IList can be used an a dataProvder, ArrayCollection is convenient because it enables the column sorting support. We've used the s:DataItem class to create data items for this example although in this case fx:Object would have worked equally well, because the example doesn't rely on data item property bindings. DataItem is used to define an untyped Object whose properties are bindable. --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"> <s:Panel title="Spark DataGrid Control Example of a very simple DataGrid" width="75%" height="75%" horizontalCenter="0" verticalCenter="0"> <s:DataGrid id="dataGrid" requestedRowCount="5" verticalCenter="0" horizontalCenter="0"> <s:ArrayCollection> <s:DataItem key="1000" name="Abrasive" price="100.11" call="false"/> <s:DataItem key="1001" name="Brush" price="110.01" call="true"/> <s:DataItem key="1002" name="Clamp" price="120.02" call="false"/> <s:DataItem key="1003" name="Drill" price="130.03" call="true"/> <s:DataItem key="1004" name="Epoxy" price="140.04" call="false"/> <s:DataItem key="1005" name="File" price="150.05" call="true"/> <s:DataItem key="1006" name="Gouge" price="160.06" call="false"/> <s:DataItem key="1007" name="Hook" price="170.07" call="true"/> <s:DataItem key="1008" name="Ink" price="180.08" call="false"/> <s:DataItem key="1009" name="Jack" price="190.09" call="true"/> </s:ArrayCollection> </s:DataGrid> </s:Panel> </s:Application>
<?xml version="1.0" encoding="utf-8"?> <!-- A simple combination of Spark DataGrid and Form that demonstrates using the DataGrid selectedItem property to connect "master" and "detail" views. The value of the DataGrid's selectedItem property is the dataProvider item that's currently selected. This example displays a Datagrid and a Form, and the Form displays various aspects of the selectedItem. Elements of the Form bind to the DataGrid's selectedItem, so when the selection changes the form is updated automatically. In a configuration like this, the DataGrid is the "master" view and the Form is the "detail" view. The selectedItem bindings are not valid unless there's a non-null selection, so we've specified requireSelection="true" for the DataGrid. Note also that we've used a CurrencyFormatter to convert Numbers that represent prices, to nicely formatted and localized strings. --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"> <fx:Declarations> <s:CurrencyFormatter id="cf" useCurrencySymbol="true"/> </fx:Declarations> <s:Panel title='Spark DataGrid Control Example demonstrates the use of selectedItem to connect "master" and "detail" views' width="75%" height="75%" horizontalCenter="0" verticalCenter="0"> <s:VGroup horizontalAlign="justify" left="5" right="5" top="5" bottom="5"> <s:DataGrid id="dataGrid" requestedRowCount="4" requireSelection="true"> <s:columns> <s:ArrayList> <s:GridColumn dataField="name" headerText="Name"/> <s:GridColumn dataField="price" headerText="Price"/> </s:ArrayList> </s:columns> <s:ArrayCollection> <s:DataItem key="1000" name="Abrasive" price="100.11" call="false"/> <s:DataItem key="1001" name="Brush" price="110.01" call="true"/> <s:DataItem key="1002" name="Clamp" price="120.02" call="false"/> <s:DataItem key="1003" name="Drill" price="130.03" call="true"/> <s:DataItem key="1004" name="Epoxy" price="140.04" call="false"/> <s:DataItem key="1005" name="File" price="150.05" call="true"/> <s:DataItem key="1006" name="Gouge" price="160.06" call="false"/> <s:DataItem key="1007" name="Hook" price="170.07" call="true"/> <s:DataItem key="1008" name="Ink" price="180.08" call="false"/> <s:DataItem key="1009" name="Jack" price="190.09" call="true"/> </s:ArrayCollection> </s:DataGrid> <s:Scroller height="100%"> <s:Group> <s:Form width="100%" height="100%"> <s:FormHeading label="Selected Product Detail" textAlign="center"/> <s:FormItem label="Product Key:"> <s:Label text="{dataGrid.selectedItem.key}"/> </s:FormItem> <s:FormItem label="Product Name:"> <s:Label text="{dataGrid.selectedItem.name}"/> </s:FormItem> <s:FormItem label="Product Price:"> <s:HGroup verticalAlign="baseline"> <s:Label text="{cf.format(dataGrid.selectedItem.price)}"/> <s:Label text="Tax: {cf.format(dataGrid.selectedItem.price * 0.0975)}"/> <s:Label text="Total: {cf.format(dataGrid.selectedItem.price * 1.0975)}"/> </s:HGroup> </s:FormItem> <s:FormItem label="Followup Needed:" > <s:HGroup verticalAlign="baseline"> <s:Label text="{(dataGrid.selectedItem.call) ? 'Yes' : 'No'}"/> <s:Button label="Call Now" enabled="{dataGrid.selectedItem.call}" click="dataGrid.selectedItem.call=false"/> </s:HGroup> </s:FormItem> </s:Form> </s:Group> </s:Scroller> </s:VGroup> </s:Panel> </s:Application>
<?xml version="1.0" encoding="utf-8"?> <!-- Demonstrate using the DataGrid typicalItem property to initialize column widths and the invalidateTypicalItem() method to notify the DataGrid about typicalItem property changes. Use the input fields at the top of the application to change typicalItem properties. Use tab to commit the typicalItem change. The DataGrid's typicalItem is used to compute the initial width of each GridColumn that doesn't specify an explicit width. When the DataGrid's width is unconstrained, then its overall width is essentially the sum of the column widths. If the DataGrid's width is constrained, for example if left and right are specified, then the typicalItem column widths may be padded so that all of the available horizontal space is allocated. The typicalItem is used the first time the DataGrid is measured and if a typicalItem wasn't specified, then the first dataProvider item is used. To compute column widths, a renderer is created and validated, its preferred size is recorded, and then the renderer is discarded. The advantage of basing column widths on the typicalItem, instead of specifying explicit GridColumn widths, is that doing so incoporates hard to predict factors like font sizes and styles, or localized text values. Because typical item column widths are cached, it's necessary to notify the DataGrid when the typicalItem has changed. This is done by calling the DataGrid invalidateTpyicalItem() method. In this example each input field calls invalidateTypicalItem() when a typicalItem property is changed. --> <s:Application applicationComplete="items.addItemAt(dataGrid.typicalItem, 0)" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"> <s:Panel title="Spark DataGrid Control Example that demonstrates using the typicalItem property to size the DataGrid" width="75%" height="75%" horizontalCenter="0" verticalCenter="0"> <s:controlBarContent> <s:VGroup gap="5"> <s:Label text="Typical Item:" fontWeight="bold" /> <s:HGroup verticalAlign="baseline"> <s:Label text="key:" textAlign="right" width="40"/> <s:TextInput text="@{dataGrid.typicalItem.key}" change="dataGrid.invalidateTypicalItem()"/> </s:HGroup> <s:HGroup verticalAlign="baseline"> <s:Label text="name:" textAlign="right" width="40"/> <s:TextInput text="@{dataGrid.typicalItem.name}" change="dataGrid.invalidateTypicalItem()"/> </s:HGroup> <s:HGroup verticalAlign="baseline"> <s:Label text="price:" textAlign="right" width="40"/> <s:TextInput text="@{dataGrid.typicalItem.price}" change="dataGrid.invalidateTypicalItem()"/> </s:HGroup> <s:HGroup verticalAlign="baseline"> <s:Label text="call:" textAlign="right" width="40"/> <s:TextInput text="@{dataGrid.typicalItem.call}" change="dataGrid.invalidateTypicalItem()"/> </s:HGroup> </s:VGroup> </s:controlBarContent> <s:DataGrid id="dataGrid" left="5" right="5" top="5" bottom="5" requestedRowCount="5"> <!-- The typicalItem defines the width of each column. We also insert it at rowIndex=0 (see applicationComplete above) to help visualize the impact of typicalItem changes. Usually the typicalItem is not displayed. --> <s:typicalItem> <s:DataItem key="99999" name="Typical Item" price="123.45" call="false"/> </s:typicalItem> <s:ArrayCollection id="items"> <s:DataItem key="1000" name="Abrasive" price="100.11" call="false"/> <s:DataItem key="1001" name="Brush" price="110.01" call="true"/> <s:DataItem key="1002" name="Clamp" price="120.02" call="false"/> <s:DataItem key="1003" name="Drill" price="130.03" call="true"/> <s:DataItem key="1004" name="Epoxy" price="140.04" call="false"/> <s:DataItem key="1005" name="File" price="150.05" call="true"/> <s:DataItem key="1006" name="Gouge" price="160.06" call="false"/> <s:DataItem key="1007" name="Hook" price="170.07" call="true"/> <s:DataItem key="1008" name="Ink" price="180.08" call="false"/> <s:DataItem key="1009" name="Jack" price="190.09" call="true"/> </s:ArrayCollection> </s:DataGrid> </s:Panel> </s:Application>
<?xml version="1.0" encoding="utf-8"?> <!-- Demonstrate the DataGrid variableRowHeight and rowHeight properties. When variableRowHeight="false" (the default) use the slider to change the row height of all the DataGrid's rows. When variableRowHeight="true", each row's height is computed. With the variableRowHeight checkbox checked, try adding enough text to a string in the "name" column to cause the renderer to wrap, or resize the column's width by dragging the header's column separators. By default all of the rows in a DataGrid have the same height. The rows' heights are defined by the rowHeight property and if its value is not specified, the computed "preferred" height of the first row is used. If the variableRowHeight property is set to true, then the height of each row is the maximum measured height of each cell that's been exposed, so far. That means that when the DataGrid's columns aren't all visible and variableRowHeight="true", scrolling new columns into view can cause a row's height to grow. Similarly, the DataGrid uses the first row's height (or the rendered height of the "typicalItem", if it was specified) as an estimate for the heights of rows that haven't been scrolled into view yet. This means that the DataGrid Grid's contentHeight, i.e. total height of all of the rows, can grow or even shrink as it's scrolled, when variableRowHeight=true. Since the scrollbar's thumb size reflects the content size, you may see its height change a little as you scroll, although as the number of rows gets large, this effect usually isn't noticeable. The runtime support for variable height rows requires quite a bit more bookkeeping than the variableRowHeight="false" case and there's a commensurate impact on performance and footprint. That's why by default the DataGrid is configured for fixed height rows. That said, item renderer complexity tends have a much bigger impact on display/scrolling performance, so developers need not shy away from specifying variableRowHeight=true, even when optimizing for performance. --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"> <s:Panel title="Spark DataGrid Control Example which demonstrates the variableRowHeight and rowHeight properties" width="75%" height="75%" horizontalCenter="0" verticalCenter="0"> <s:controlBarContent> <s:HGroup verticalAlign="baseline"> <s:CheckBox label="variableRowHeight={dataGrid.variableRowHeight}" selected="@{dataGrid.variableRowHeight}"/> <s:Label text=" "/> <!-- blank space --> <s:HSlider minimum="12" maximum="120" value="@{dataGrid.grid.rowHeight}"/> <s:Label text="rowHeight={dataGrid.grid.rowHeight}"/> </s:HGroup> </s:controlBarContent> <s:DataGrid id="dataGrid" left="5" right="5" top="5" bottom="5" editable="true"> <s:ArrayCollection> <s:DataItem key="1000" name="Abrasive" price="100.11" call="false"/> <s:DataItem key="1001" name="Brush" price="110.01" call="true"/> <s:DataItem key="1002" name="Clamp" price="120.02" call="false"/> <s:DataItem key="1003" name="Drill" price="130.03" call="true"/> <s:DataItem key="1004" name="Epoxy" price="140.04" call="false"/> <s:DataItem key="1005" name="File" price="150.05" call="true"/> <s:DataItem key="1006" name="Gouge" price="160.06" call="false"/> <s:DataItem key="1007" name="Hook" price="170.07" call="true"/> <s:DataItem key="1008" name="Ink" price="180.08" call="false"/> <s:DataItem key="1009" name="Jack" price="190.09" call="true"/> </s:ArrayCollection> </s:DataGrid> </s:Panel> </s:Application>
<?xml version="1.0" encoding="utf-8"?> <!-- A DataGrid example that demonstrates the selectionChange and selectionChanging events, the "multipleCells" selection mode, a dataProvider that's a two dimensional array of numbers, and a column whose values are computed and can not be selected. This application displays the min, max, and average value of the selected cells. The DataGrid's last column displays the computed min and max values for each row. DataGrid supports five selection modes including GridSelectionMode.MULTIPLE_CELLS ("multipleCells"). Specifying selectionMode="multipleCells" enables selection of individual cells with mouse click or control-click or rectangular groups of cells with shift-click. Each time the user attempts to change the selection the DataGrid dispatches a "selectionChanging" event and, if that event is not cancelled with event.preventDefault(), a "selectionChange" and a "valueCommit" event. This application uses the changing event to cancel attempts to include the last column in the selection, because the last column isn't part of the dataProvider, it's just a summary of the row's values in term of the minumum and maximum. To handle the special case where the user attempts to select all cells by typing control-A, we cancel the selectionChanging event and then use dataGrid.selectCellRegion() to select all cells except those in the last column. The valueCommit event is dispatched when the selection changes for any reason, not just in response to user input, and so we use that to update the selectionMinimum,Maximum,Average variables. Each time the selection changes, the application's selectionChangeHandler() method updates the three bindable variables that are dispayed in the control bar. The DataGrid's selectedCells property contains the row,column indices of the selected cells as a Vector of CellPosition objects. --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"> <!-- Defines three [Bindable] global variables --> <fx:Declarations> <fx:Number id="selectionMinimum"/> <fx:Number id="selectionMaximum"/> <fx:Number id="selectionAverage"/> </fx:Declarations> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; import spark.components.gridClasses.CellPosition; import spark.components.gridClasses.CellRegion; import spark.events.GridSelectionEvent; import spark.events.GridSelectionEventKind; // Create a dataProvider whose items are arrays of 6 random numbers. The DataGrid's // item renderer will display item[columnIndex]. private function initializeDataProvider():void { const nRows:int = 100; const nCols:int = 6; const dataArray:Array = new Array(nRows); for (var rowIndex:int = 0; rowIndex < dataArray.length; rowIndex++) { var values:Array = new Array(nCols); for (var columnIndex:int = 0; columnIndex < values.length; columnIndex++) values[columnIndex] = Math.round(Math.random() * 1000); dataArray[rowIndex] = values; } dataGrid.dataProvider = new ArrayCollection(dataArray); const typicalItem:Array = new Array(nCols); for (columnIndex = 0; columnIndex < typicalItem.length; columnIndex++) typicalItem[columnIndex] = 99999; dataGrid.typicalItem = typicalItem; } // Return the dataProvider cell value displayed at rowIndex, columnIndex public function getCellValue(rowIndex:int, columnIndex:int):Number { return dataGrid.dataProvider.getItemAt(rowIndex)[columnIndex]; } // Update the Bindable variables: selectionMin,Max,Average based on the selected cells private function selectionChangeHandler():void { const selectedCells:Vector.<CellPosition> = dataGrid.selectedCells; var min:Number = NaN; var max:Number = NaN; var sum:Number = 0; for each (var cell:CellPosition in selectedCells) { var value:Number = getCellValue(cell.rowIndex, cell.columnIndex); min = isNaN(min) ? value : Math.min(min, value); max = isNaN(max) ? value : Math.max(max, value); sum += value; } selectionMinimum = min; selectionMaximum = max; selectionAverage = (selectedCells.length > 0) ? Math.round((sum / selectedCells.length)) : NaN; } // Prevent the user from selecting the last column private function selectionChangingHandler(event:GridSelectionEvent):void { const lastColumnIndex:int = dataGrid.columns.length - 1; const selectionChange:CellRegion = event.selectionChange; const rightSelectionIndex:int = selectionChange.columnIndex + selectionChange.columnCount - 1; if (rightSelectionIndex == lastColumnIndex) { event.preventDefault(); // If the user was trying to select-All then do so after clipping the last column if (event.kind == GridSelectionEventKind.SELECT_ALL) dataGrid.selectCellRegion(0, 0, selectionChange.rowCount, selectionChange.columnCount - 1); } } ]]> </fx:Script> <!-- The DataGrid's dataProvider and typicalItem are set at initialize time by the initializeDataProvider method. --> <s:Panel title="Spark DataGrid Control Example that demonstrates selection including a computed column which is not selectable" width="75%" height="75%" horizontalCenter="0" verticalCenter="0"> <!-- To make the label look "disabled" when there's no selection, we set its alpha="0.5". --> <s:controlBarContent> <s:Label alpha="{(dataGrid.selectionLength > 0) ? 1.0 : 0.5}" text="Selected Cells: minimum = {selectionMinimum}, maximum = {selectionMaximum}, average = {selectionAverage}"/> </s:controlBarContent> <s:DataGrid id="dataGrid" left="5" right="5" top="5" bottom="5" alternatingRowColors="[0xFFFFFF, 0xEDFFE9]" selectionMode="multipleCells" valueCommit="selectionChangeHandler()" selectionChanging="selectionChangingHandler(event)" initialize="initializeDataProvider()"> <!-- The default item renderer is used by the first 6 columns to display the dataProvider item's array element value at columnIndex. --> <s:itemRenderer> <fx:Component> <s:DefaultGridItemRenderer> <fx:Script> <![CDATA[ override public function prepare(hasBeenRecycled:Boolean):void { label = data[columnIndex]; } ]]> </fx:Script> </s:DefaultGridItemRenderer> </fx:Component> </s:itemRenderer> <s:columns> <s:ArrayList> <!-- The first six columns inherit the DataGrid's itemRenderer. --> <s:GridColumn headerText="C0"/> <s:GridColumn headerText="C1"/> <s:GridColumn headerText="C2"/> <s:GridColumn headerText="C3"/> <s:GridColumn headerText="C4"/> <s:GridColumn headerText="C5"/> <!-- The last column specifies its own item renderer that displays the min and max values for the entire row. --> <s:GridColumn headerText="Row Min, Max"> <s:itemRenderer> <fx:Component> <s:DefaultGridItemRenderer fontStyle="italic" color="0x734669"> <fx:Script> <![CDATA[ override public function prepare(hasBeenRecycled:Boolean):void { var min:Number = Math.min.apply(null, data as Array); var max:Number = Math.max.apply(null, data as Array); label = min + ", " + max; } ]]> </fx:Script> </s:DefaultGridItemRenderer> </fx:Component> </s:itemRenderer> </s:GridColumn> </s:ArrayList> </s:columns> </s:DataGrid> </s:Panel> </s:Application>
<?xml version="1.0" encoding="utf-8"?> <!-- This example demonstrates the use of the DataGrid invalidateCell() method. Pressing the "Run" button starts a timer that updates DataGrid cells at the rate specified with the slider. This "Christmas Tree" DataGrid example displays a dataProvider with items whose substructure is constantly changing. Each dataProvider item has one object valued property per column, and each of those properties has an object value that defines what's displayed in a single cell. To keep things simple the column properties are just called "C0", "C1", ... and the value of each property is an object itself, with "color" and "index" properties, like {color:NN, index:NN}. So the data for the cell at rowIndex=10, columnIndex=5: dataGrid.dataProvider.getItemAt(10)["C5"] => {color:0xFF6C0D, index:4} The DataGrid has no way of knowing when the color,index data for a cell has been updated so the developer must call invalidateCell(rowIndex, columnIndex) to let the DataGrid know that the specified cell must be redisplayed. When the "Run" button is toggled on, updateTimerHandler() method below is called up to 64 times/second and each time it updates a single random cell's color and index properties and then calls invalidateCell(). Calling invalidateCell() only causes the (one) corresponding item renderer to redisplay, so long as doing so doesn't invalidate the corresponding row's height. That can occur if variableRowHeight=true and if it does, the entire DataGrid is redisplayed. The CPU load produced by applications like this one is only proportional to the update rate and the renderers' complexity, so long as the overall grid layout isn't affected by the cell updates. Using fixed height rows with variableRowHeight="false" (the default), simple item renderers, and not dynamically changing column widths, are good ways to ensure that the CPU load is minimized. --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"> <fx:Script> <![CDATA[ import mx.collections.ArrayList; import spark.components.gridClasses.GridColumn; // DatGrid size. Roughly fills my laptop screen if the application window is maximized. private var columnCount:int = 16; private var rowCount:int = 16; // Colors from the "tropical breakfast" theme, http://kuler.adobe.com/#themeID/1194065 private var colors:Array = [0x216273, 0x44996F, 0xE5C10F, 0xF29E00, 0xFF6C0D]; [Bindable] private var updatesPerSecond:Number = 12; // update "rate" private var updateTimer:Timer = null; // Initialize the DataGrid's columns, dataProvider and typicalItem. We're creating // columnCount columns and rowCount rows (dataProvider items). The value of each // dataProvider item is an object with one property per column, called // "C0", "C1", ... The value of each of those "C<N>" properties is a {color:NN, index:NN} // object that defines what's displayed in an individual cell. private function initializeDataGrid():void { const columnsArray:Array = new Array(columnCount); const typicalItem:Object = {}; const dataArray:Array = new Array(rowCount); for (var columnIndex:int = 0; columnIndex < columnCount; columnIndex++) { var columnProperty:String = "C" + columnIndex; columnsArray[columnIndex] = new GridColumn(columnProperty); typicalItem[columnProperty] = {color:0, index:0}; } for(var rowIndex:int = 0; rowIndex < rowCount; rowIndex++) { var item:Object = {}; for (columnIndex = 0; columnIndex < columnCount; columnIndex++) item["C" + columnIndex] = {color:colors[0], index:0}; dataArray[rowIndex] = item; } dataGrid.columns = new ArrayList(columnsArray); dataGrid.typicalItem = typicalItem; dataGrid.dataProvider = new ArrayList(dataArray); } // Toggle the timer that changes the data and calls invalidateCell(). // See updateTimerHandler(). private function runTest():void { if (!updateTimer) { updateTimer = new Timer(1000.0 / updatesPerSecond); updateTimer.addEventListener(TimerEvent.TIMER, updateTimerHandler); } if (runToggleButton.selected) { updateTimer.start(); } else { updateTimer.stop(); cellLocationLabel.text = ""; } } private static function randomIndex(length:int):int { return Math.round(Math.random() * (length - 1)); } // When the timer is running this method is called updatesPerSecond times per second. // It modifies the index and color properties for a single cell and then calls // invalidateCell() to let the DataGrid now that the cell needs to be redisplayed. // See initializeDataGrid() for more about how the data for each cell is defined. private function updateTimerHandler(event:TimerEvent):void { const rowIndex:int = randomIndex(rowCount); const columnIndex:int = randomIndex(columnCount); cellLocationLabel.text = "(" + rowIndex + ", " + columnIndex + ")"; const item:Object = dataGrid.dataProvider.getItemAt(rowIndex); const columnProperty:String = "C" + columnIndex; const index:int = Math.min(item[columnProperty].index + 1, colors.length - 1); item[columnProperty].index = index; item[columnProperty].color = colors[index]; dataGrid.invalidateCell(rowIndex, columnIndex); } private function changeUpdateRate():void { if (updateTimer) updateTimer.delay = 1000.0 / updatesPerSecond; } ]]> </fx:Script> <s:Panel title="Spark DataGrid Control Example demonstrates the use of the DataGrid invalidateCell() method" width="75%" height="75%" horizontalCenter="0" verticalCenter="0"> <s:controlBarContent> <s:HGroup verticalAlign="baseline" width="100%"> <s:ToggleButton id="runToggleButton" label="Run" change="runTest()"/> <s:HSlider id="updateRateSlider" minimum="1" maximum="64" value="@{updatesPerSecond}" snapInterval="1" changeEnd="changeUpdateRate()"/> <s:Label id="updateRateLabel" text="{updateRateSlider.value} updates/second" /> <s:Label id="cellLocationLabel" width="100%" textAlign="right"/> </s:HGroup> </s:controlBarContent> <s:DataGrid id="dataGrid" left="5" right="5" top="5" bottom="5" initialize="initializeDataGrid()"> <!-- We're using one item renderer for *all* columns, so the renderer is responsible for looking up the dataProvider item's column specific value. --> <s:itemRenderer> <fx:Component> <s:GridItemRenderer> <fx:Script> <![CDATA[ // Each dataProvider item has one {color:NN, index:NN} object valued // property whose name is the same as the column's dataField. For // example the first column's dataField is "C0" and so this.data["C0"] // is the renderer's color,index object. We use the color and index // properties to initialize the renderer here. override public function prepare(hasBeenRecycled:Boolean):void { colorDisplay.color = data[column.dataField].color; indexDisplay.text = String(data[column.dataField].index); } ]]> </fx:Script> <!-- black item renderer background with alpha=0.75 to expose the selection/hover indicators --> <s:Rect left="0" right="0" top="0" bottom="0"> <s:fill> <s:SolidColor alpha="0.75" color="0x000000"/> </s:fill> </s:Rect> <!-- single digit text, displays index property --> <s:Label id="indexDisplay" left="45" verticalCenter="0" right="5" color="0XFFFFFF" fontSize="20"/> <!-- 30x30 filled circle, displays color property --> <s:Ellipse left="5" top="5" bottom="5" width="30" height="30"> <s:stroke> <s:SolidColorStroke color="0x000000" weight="2"/> </s:stroke> <s:fill> <s:SolidColor id="colorDisplay"/> </s:fill> </s:Ellipse> </s:GridItemRenderer> </fx:Component> </s:itemRenderer> </s:DataGrid> </s:Panel> </s:Application>
Tue Jun 12 2018, 11:04 AM Z