Displays a Button that may be triggered to display a GridView as a pop-up. The grid view may be customized to display in different ways, such as a drop-down, inside a Callout, or as a modal overlay.

The following example creates a pop-up grid, gives it a data provider, tells the item renderer how to interpret the data, and listens for when the selection changes:

var popUpGridView = new PopUpGridView();

popUpGridView.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" }
]);
popUpGridView.columns = new ArrayCollection([
	new GridViewColumn("Item", (data) -> data.item),
	new GridViewColumn("Department", (data) -> data.dept),
	new GridViewColumn("Price", (data) -> data.price)
]);

popUpGridView.itemToText = (data:Dynamic) -> {
	return data.item;
};

popUpGridView.addEventListener(Event.CHANGE, (event:Event) -> {
	var popUpGridView = cast(event.currentTarget, PopUpGridView);
	trace("PopUpGridView changed: " + popUpGridView.selectedIndex + " " + popUpGridView.selectedItem.text);
});

this.addChild(popUpGridView);

Events:

openfl.events.Event.CHANGE

Dispatched when either PopUpGridView.selectedItem or PopUpGridView.selectedIndex changes.

openfl.events.Event.OPEN

Dispatched when the pop-up grid view is opened.

openfl.events.Event.CLOSE

Dispatched when the pop-up grid view is closed.

feathers.events.GridViewEvent.CELL_TRIGGER

Dispatched when the user taps or clicks an item renderer in the pop-up grid view. The pointer must remain within the bounds of the item renderer on release, and the grid view cannot scroll before release, or the gesture will be ignored.

Available since

feathersui-data-containers-pack 1.0.0

.

See also:

Static variables

@:value("popUpGridView_button")staticfinalread onlyCHILD_VARIANT_BUTTON:String = "popUpGridView_button"

The variant used to style the Button child component in a theme.

To override this default variant, set the PopUpGridView.customButtonVariant property.

Available since

feathersui-data-containers-pack 1.0.0

.

See also:

@:value("popUpGridView_gridView")staticfinalread onlyCHILD_VARIANT_GRID_VIEW:String = "popUpGridView_gridView"

The variant used to style the GridView child component in a theme.

To override this default variant, set the PopUpGridView.customGridViewVariant property.

Available since

feathersui-data-containers-pack 1.0.0

.

See also:

Constructor

new(?dataProvider:IFlatCollection<Dynamic>, ?changeListener:Event ‑> Void)

Creates a new PopUpGridView object.

Available since

feathersui-data-containers-pack 1.0.0

.

Variables

buttonFactory:AbstractDisplayObjectFactory<Dynamic, Button>

Creates the button, which must be of type feathers.controls.Button.

In the following example, a custom button factory is provided:

popUpGridView.buttonFactory = () ->
{
	return new Button();
};
Available since

feathersui-data-containers-pack 1.0.0

.

See also:

  • feathers.controls.Button

cellRendererRecycler:AbstractDisplayObjectRecycler<Dynamic, GridViewCellState, DisplayObject>

Manages cell renderers used by the pop-up grid view.

In the following example, the pop-up grid view uses a custom cell renderer class:

popUpGridView.cellRendererRecycler = DisplayObjectRecycler.withClass(CustomItemRenderer);
Available since

feathersui-data-containers-pack 1.0.0

.

See also:

  • feathers.controls.dataRenderers.ItemRenderer

  • feathers.controls.dataRenderers.LayoutGroupItemRenderer

columns:IFlatCollection<GridViewColumn>

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:

popUpGridView.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" }
]);
popUpGridView.columns = new ArrayCollection([
	new GridViewColumn("Item", (data) -> data.item),
	new GridViewColumn("Department", (data) -> data.dept),
	new GridViewColumn("Price", (data) -> data.price)
]);
Available since

feathersui-data-containers-pack 1.0.0

.

See also:

@:style@:flash.propertycustomButtonVariant:String

A custom variant to set on the button, instead of PopUpGridView.CHILD_VARIANT_BUTTON.

The customButtonVariant will be not be used if the result of buttonFactory already has a variant set.

Available since

feathersui-data-containers-pack 1.0.0

.

See also:

@:style@:flash.propertycustomGridViewVariant:String

A custom variant to set on the pop-up grid view, instead of PopUpGridView.CHILD_VARIANT_GRID_VIEW.

The customGridViewVariant will be not be used if the result of gridViewFactory already has a variant set.

Available since

feathersui-data-containers-pack 1.0.0

.

See also:

@:bindable("dataChange")dataProvider:IFlatCollection<Dynamic>

The collection of data displayed by the grid view.

Items in the collection must be class instances or anonymous structures. Do not add primitive values (such as strings, booleans, or numeric values) directly to the collection.

Additionally, all items in the collection must be unique object instances. Do not add the same instance to the collection more than once because a runtime exception will be thrown.

The following example passes in a data provider and tells the item renderer how to interpret the data:

popUpGridView.dataProvider = new ArrayCollection([
	{ text: "Milk" },
	{ text: "Eggs" },
	{ text: "Bread" },
	{ text: "Chicken" },
]);

popUpGridView.itemToText = (item:Dynamic) -> {
	return item.text;
};
Available since

feathersui-data-containers-pack 1.0.0

.

See also:

  • feathers.data.ArrayCollection

gridViewFactory:AbstractDisplayObjectFactory<Dynamic, GridView>

Creates the grid view that is displayed as a pop-up. The grid view must be of type feathers.controls.GridView.

In the following example, a custom grid view factory is provided:

popUpGridView.gridViewFactory = () ->
{
	return new GridView();
};
Available since

feathersui-data-containers-pack 1.0.0

.

See also:

  • feathers.controls.GridView

read onlymaxSelectedIndex:Int

Available since

feathersui-data-containers-pack 1.0.0

.

See also:

  • feathers.core.IIndexSelector.maxSelectedIndex

read onlyopen:Bool

Indicates if the grid view pop-up is open or closed.

Available since

feathersui-data-containers-pack 1.0.0

.

See also:

@:style@:flash.propertypopUpAdapter:IPopUpAdapter

Manages how the grid view is displayed when it is opened and closed.

In the following example, a custom pop-up adapter is provided:

popUpGridView.popUpAdapter = new DropDownPopUpAdapter();
Available since

feathersui-data-containers-pack 1.0.0

.

prompt:String

The text displayed by the button when no item is selected.

The following example sets the pop-up grid view's prompt:

popUpGridView.prompt = "Select an item";
Available since

feathersui-data-containers-pack 1.0.0

.

@:bindable("change")selectedIndex:Int

Available since

feathersui-data-containers-pack 1.0.0

.

See also:

  • feathers.core.IIndexSelector.selectedIndex

@:bindable("change")selectedItem:Dynamic

Available since

feathersui-data-containers-pack 1.0.0

.

See also:

  • feathers.core.IDataSelector.selectedItem

Methods

closeGridView():Void

Closes the pop-up grid, if it is open.

The following example closes the pop-up grid:

if(popUpGridView.open)
{
	popUpGridView.closeGridView();
}

When the pop-up grid closes, the component will dispatch an event of type Event.CLOSE.

Available since

feathersui-data-containers-pack 1.0.0

.

See also:

dynamicitemToText(data:Dynamic):String

Converts an item to text to display within the Button, if the item is selected. By default, the toString() method is called to convert an item to text. This method may be replaced to provide custom text.

For example, consider the following item:

{ text: "Example Item" }

If the Button should display the text "Example Item", a custom implementation of itemToText() might look like this:

popUpGridView.itemToText = (item:Dynamic) -> {
	return item.text;
};
Available since

feathersui-data-containers-pack 1.0.0

.

openGridView():Void

Opens the pop-up grid, if it is not already open.

The following example opens the pop-up grid:

if(!popUpGridView.open)
{
	popUpGridView.openGridView();
}

When the pop-up grid opens, the component will dispatch an event of type Event.OPEN.

Available since

feathersui-data-containers-pack 1.0.0

.

See also: