(Preview)
Package | spark.components.gridClasses |
Class | public class GridColumn |
Inheritance | GridColumn ![]() ![]() |
Language Version: | ActionScript 3.0 |
Product Version: | Flex 4.5 |
Runtime Versions: | Flash Player 10, AIR 2.5 |

The <s:GridColumn>
tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:
<s:GridColumn Properties dataField="null" dataTipField="null" dataTipFormatter="null" dataTipFunction="null" editable="true" formatter="null" headerRenderer="null" headerText="value of dataField" imeMode="null" itemEditor="null" itemRenderer="null" itemRendererFunction="null" labelFunction="null" maxWidth="NaN" minWidth="20" rendererIsEditable="false" resizeable="true" showDataTips="undefined" sortable="true" sortCompareFunction="null" sortDescending="false" visible="true" width="NaN" />
More examples
Related API Elements
Public Properties
Property | Defined By | ||
---|---|---|---|
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance. | Object |
Public Methods
Method | Defined By | ||
---|---|---|---|
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | EventDispatcher | |
![]() |
Dispatches an event into the event flow. | EventDispatcher | |
![]() |
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | EventDispatcher | |
![]() |
Indicates whether an object has a specified property defined. | Object | |
![]() |
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | |
![]() |
Indicates whether the specified property exists and is enumerable. | Object | |
![]() |
Removes a listener from the EventDispatcher object. | EventDispatcher | |
![]() |
Sets the availability of a dynamic property for loop operations. | Object | |
![]() |
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | |
![]() |
Returns the string representation of the specified object. | Object | |
![]() |
Returns the primitive value of the specified object. | Object | |
![]() |
Checks whether an event listener is registered with this EventDispatcher object or any of
its ancestors for the specified event type. | EventDispatcher |
Public Constants
Constant | Defined By |
---|
Property Detail
Constructor Detail
Method Detail
Constant Detail
Examples How to use this example
GridColumnExample.mxml
<?xml version="1.0" encoding="utf-8"?> <!-- A simple example of a DataGrid with explicitly specified columns. The DataGrid's columns are specified by an ArrayList (an IList) and can always be accessed as such. For example dataGrid.columns.length returns the total number of columns and dataGrid.columns.getItemAt(index) returns the GridColumn at the specified index. The columns list is mutable, which means that GridColumns can be added or removed at any time. Column widths do not depend on the column's headerText, they're based on the rendered widths of the DataGrid's typicalItem. If that's not specified, then the first data item is used. That's the case here. Each column can specify an explicit width and by default all GridColumns are resizable="true", which means that the column can be interactively resized by dragging the edges between columns. Interactively resizing column widths changes the DataGrid's measuredWidth which can be a little disconcerting if the DataGrid's width is not constrained. In this example we've constrained the DataGrid's left and right edges which prevents changes in the DataGrid's measuredWidth from affecting its actual width. --> <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 a simple DataGrid with explicitly specified columns" width="75%" height="75%" horizontalCenter="0" verticalCenter="0"> <s:DataGrid id="dataGrid" left="5" right="5" top="5" bottom="5"> <s:columns> <s:ArrayList> <s:GridColumn dataField="key" headerText="Key"/> <s:GridColumn dataField="name" headerText="Name"/> <s:GridColumn dataField="price" headerText="Price"/> <s:GridColumn dataField="call" headerText="Call"/> </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:Panel> </s:Application>
GridColumnVisibilityExample.mxml
<?xml version="1.0" encoding="utf-8"?> <!-- Demonstrate the GridColumn visible property and the support for dynamically adding and removing columns. After selecting a column it's visibility can be changed, a copy of the column can be inserted, and the column can be removed. The DataGrid columns property is a mutable list - an IList, like ArrayList - and columns can be added or removed at any time. The difference between an IList and an intrinsic collection type like Array or Vector is that ILists dispatch events when they're changed. That's why the DropDownList, whose dataProvider is the list of columns, tracks the changes made with the Add/Remove buttons. Changing a column's visibility does not change its presence or position in the columns IList but it prevents the DataGrid from displaying it. --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"> <fx:Script> <![CDATA[ // Insert a column to the left of specified column private function addNewColumn(column:GridColumn):void { const newColumn:GridColumn = new GridColumn(); newColumn.dataField = column.dataField; newColumn.headerText = column.headerText + "+"; dataGrid.columns.addItemAt(newColumn, column.columnIndex); } // Remove the specified column private function removeColumn(column:GridColumn):void { dataGrid.columns.removeItemAt(column.columnIndex); } ]]> </fx:Script> <s:Panel title="Spark DataGrid Control Example which demonstrates the GridColumn visible property and dynamically adding and removing columns" width="75%" height="75%" horizontalCenter="0" verticalCenter="0"> <s:controlBarContent> <s:HGroup verticalAlign="baseline"> <s:DropDownList id="ddl" prompt="Select" dataProvider="{dataGrid.columns}" labelField="headerText"/> <s:Label text="Visible:"/> <s:CheckBox selected="@{ddl.selectedItem.visible}" enabled="{ddl.selectedItem}"/> <s:Button label="Add" click="addNewColumn(ddl.selectedItem)" enabled="{ddl.selectedItem}"/> <s:Button label="Remove" click="removeColumn(ddl.selectedItem)" enabled="{ddl.selectedItem}"/> </s:HGroup> </s:controlBarContent> <s:DataGrid id="dataGrid" left="5" right="5" top="5" bottom="5"> <s:columns> <s:ArrayList> <s:GridColumn dataField="key" headerText="Key"/> <s:GridColumn dataField="name" headerText="Name"/> <s:GridColumn dataField="price" headerText="Price"/> <s:GridColumn dataField="call" headerText="Call"/> </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:Panel> </s:Application>
Wed Nov 21 2018, 06:34 AM -08:00