Class: DefaultListItemRenderer

DefaultListItemRenderer

DefaultListItemRenderer

new GOWN.DefaultListItemRenderer(theme)

The default list item renderer.
Name Type Description
theme GOWN.Theme optional theme for the DefaultListItemRenderer

Extends

Members

allowDestroyCachebool

Will destroy the skin cache when the skinable gets destroyed
Default Value:
  • true

currentStateString

The current state

data

Data

enabledBoolean

Enables/Disables the control. (not implemented yet)

labelString

Create/Update the label of the button.

labelFieldString

A key in the item data that will be shown as label for the item. e.g. 'text' for item.text. will be ignored if labelFunction is set. the item will be shown directly (using toString) if labelField and labelFunction are not set.
Default Value:
  • 'text'

labelFunctionfunction

A function used to generate label text for a specific item. If this function is not null, then the labelField will be ignored.

In the following example, the label function is customized:

renderer.labelFunction = function( item ) { return item.firstName + " " + item.lastName; };
Default Value:
  • null
See:

selectedBoolean

Indicate if the button is selected (pressed)
Default Value:
  • false

skinFallbackString

The fallback skin if the other skin does not exist (e.g. if a mobile theme that does not provide a "hover" state is used on a desktop system)

skinNameString

The skin name
Default Value:
  • Button.SKIN_NAME

Methods

inherited changeSkin(skin)

Remove old skin and add new one
Name Type Description
skin DisplayObject
Updates the renderer to display the item's data. Override this function to pass data to sub-components and react to data changes.

Don't forget to handle the case where the data is null.

Destroy the Skinable and empty the skin cache

inherited fromSkin(name, callback)

Get image from skin (will execute a callback with the loaded skin when it is loaded or call it directly when it already is loaded)
Name Type Description
name String name of the state
callback function callback that is executed if the skin is loaded

inherited protectedhandleEvent(type)

handle the touch/tap event
Name Type Description
type Object the type of the press/touch.
Using labelField and labelFunction, generates a label from the item.

All of the label fields and functions, ordered by priority:

  1. labelFunction
  2. labelField
Name Type Description
item the item that gets converted to a label

inherited mousePos(){PIXI.Point}

Get the local mouse position from PIXI.InteractionData
Returns:
Type Description
PIXI.Point
onDown callback

inherited protectedonHover()

onHover callback
onOut callback

inherited protectedonTouchMove()

onTouchMove callback
onUp callback

inherited protectedpreloadSkins()

Initiate all skins first (to prevent flickering)
Update button text before draw call
Change the theme
Name Type Description
theme GOWN.Theme the new theme

inherited protectedskinLoaded(skin)

Skin has been loaded (see preloadSkins) and stored into the skinCache. add to container, hide and resize
Name Type Description
skin the loaded skin
Toggle the state

inherited protectedupdateDimensions()

Update width/height of the button

inherited updateTheme(data)

Overwrite data from theme for this specific component. (usable if you want to change e.g. background color based on selected items)
Name Type Description
data updated skin data