class GridView
package feathers.controls
extends BaseScrollContainer › FeathersControl › MeasureSprite › ValidatingSprite
implements IDataSelector<Dynamic>, IIndexSelector
Displays a list of items as a table. Each item is rendered as a row, divided into columns for each of the item's fields. Supports scrolling, custom cell, sorting columns, resizing columns, and drag and drop re-ordering of columns.
The following example creates a grid view, gives it a data provider, tells the columns how to interpret the data, and listens for when the selection changes:
var gridView = new GridView();
gridView.dataProvider = new ArrayCollection([
	{ item: "Chicken breast", dept: "Meat", price: "5.90" },
	{ item: "Butter", dept: "Dairy", price: "4.69" },
	{ item: "Broccoli", dept: "Produce", price: "2.99" },
	{ item: "Whole Wheat Bread", dept: "Bakery", price: "2.49" }
]);
gridView.columns = new ArrayCollection([
	new GridViewColumn("Item", (data) -> data.item),
	new GridViewColumn("Department", (data) -> data.dept),
	new GridViewColumn("Price", (data) -> data.price)
]);
gridView.addEventListener(Event.CHANGE, (event:Event) -> {
	var gridView = cast(event.currentTarget, GridView);
	trace("GridView changed: " + gridView.selectedIndex + " " + gridView.selectedItem.item);
});
this.addChild(gridView);1.0.0
.See also:
Static variables
staticfinalread onlyVARIANT_BORDER:String = "border"
A variant used to style the grid view with a border. This variant is used by default on desktop.
The following example uses this variant:
var gridView = new GridView();
gridView.variant = GridView.VARIANT_BORDER;1.0.0
.See also:
staticfinalread onlyVARIANT_BORDERLESS:String = "borderless"
A variant used to style the grid view without a border. The variant is used by default on mobile.
The following example uses this variant:
var gridView = new GridView();
gridView.variant = GridView.VARIANT_BORDERLESS;1.0.0
.See also:
Constructor
Variables
cellRendererRecycler:DisplayObjectRecycler<Dynamic, GridViewCellState, DisplayObject> = DisplayObjectRecycler.withClass(CellRenderer)
Manages cell renderers used by the grid view.
In the following example, the grid view uses a custom cell renderer class:
gridView.cellRendererRecycler = DisplayObjectRecycler.withClass(CustomCellRenderer);1.0.0
.columns:IFlatCollection<GridViewColumn> = null
Defines the set of columns to display for each item in the grid view's
data provider. If null, the grid view will attempt to populate the
columns automatically using
reflection.
The following example passes in a data provider and tells the columns how to interpret the data:
gridView.dataProvider = new ArrayCollection([
	{ item: "Chicken breast", dept: "Meat", price: "5.90" },
	{ item: "Butter", dept: "Dairy", price: "4.69" },
	{ item: "Broccoli", dept: "Produce", price: "2.99" },
	{ item: "Whole Wheat Bread", dept: "Bakery", price: "2.49" }
]);
gridView.columns = new ArrayCollection([
	new GridViewColumn("Item", (data) -> data.item),
	new GridViewColumn("Department", (data) -> data.dept),
	new GridViewColumn("Price", (data) -> data.price)
]);1.0.0
.See also:
dataProvider:IFlatCollection<Dynamic> = null
The collection of data displayed by the grid view.
The following example passes in a data provider and tells the columns how to interpret the data:
gridView.dataProvider = new ArrayCollection([
	{ item: "Chicken breast", dept: "Meat", price: "5.90" },
	{ item: "Butter", dept: "Dairy", price: "4.69" },
	{ item: "Broccoli", dept: "Produce", price: "2.99" },
	{ item: "Whole Wheat Bread", dept: "Bakery", price: "2.49" }
]);
gridView.columns = new ArrayCollection([
	new GridViewColumn("Item", (data) -> data.item),
	new GridViewColumn("Department", (data) -> data.dept),
	new GridViewColumn("Price", (data) -> data.price)
]);1.0.0
.See also:
headerRendererRecycler:DisplayObjectRecycler<Dynamic, GridViewHeaderState, DisplayObject> = DisplayObjectRecycler.withFunction(function() ->  @:implicitReturn return {
	var headerRenderer = new ItemRenderer();
	headerRenderer.toggleable = false;
	return headerRenderer;
})
Manages header renderers used by the grid view.
In the following example, the grid view uses a custom header renderer class:
gridView.headerRendererRecycler = DisplayObjectRecycler.withClass(CustomHeaderRenderer);1.0.0
.selectable:Bool = true
Determines if items in the grid view may be selected. By default only a single item may be selected at any given time. In other words, if item A is already selected, and the user selects item B, item A will be deselected automatically.
The following example disables selection of items in the grid view:
gridView.selectable = false;See also:
virtualLayout:Bool = true
Indicates if the grid view's layout is allowed to virtualize items or not.
The following example disables virtual layouts:
gridView.virtualLayout = false;1.0.0
.Methods
scrollToRowIndex(rowIndex:Int, ?animationDuration:Float):Void
Scrolls the grid view so that the specified row is completely visible. If the row is already completely visible, does not update the scroll position.
A custom animation duration may be specified. To update the scroll
position without animation, pass a value of 0.0 for the duration.
@since 1.0.0