inputEx Documentation Back to homepage

### inputEx Documentation > inputEx.ListField 0.2.2

## Static Class inputEx.ListField - extends inputEx.Field

Meta field to create a list of other fields

Known Subclasses:
  inputEx.TreeField

### Constructor

inputEx.ListField `( options )`

Parameters:
  `options <Object>` - Added options:
  - sortable: Add arrows to sort the items if true (default false)
  - elementType: an element type definition (default is {type: 'string'})
  - useButtons: use buttons instead of links (default false)
  - unique: require values to be unique (default false)
  - listAddLabel: if useButtons is false, text to add an item
  - listRemoveLabel: if useButtons is false, text to remove an item

### Properties

#### static groupOptions `- Object`

group Options for each field

#### options `- Object`

Configuration object to set the options for this class and the parent classes. See constructor details for options added by this class.

#### subFields `- Object`

List of all the subField instances

### Methods

#### addElement

`<inputEx.Field> addElement(The)`
Adds an element
Parameters:

`The <Any>` - initial value of the subfield to create

Returns:

`<inputEx.Field>` SubField added instance

#### getValue

`<Array> getValue()`
Return the array of values
Returns:

`<Array>` The array

#### initEvents

`initEvents()`
Handle the click event on the add button

#### onAddButton

`onAddButton(e)`
Add a new element to the list and fire updated event
Parameters:

`e <Event>` - The original click event

#### onArrowDown

`onArrowDown(e)`
Switch a subField with its next one Called when the user clicked on the down arrow of a sortable list
Parameters:

`e <Event>` - Original click event

#### onArrowUp

`onArrowUp(e)`
Switch a subField with its previous one Called when the user clicked on the up arrow of a sortable list
Parameters:

`e <Event>` - Original click event

#### onDelete

`onDelete(e)`
Called when the user clicked on a delete button.
Parameters:

`e <Event>` - The original click event

#### removeElement

`removeElement(index)`
Remove the line from the dom and the subField from the list.
Parameters:

`index <integer>` - The index of the element to remove

#### renderComponent

`renderComponent()`
Render the addButton

#### renderSubField

`<inputEx.Field> renderSubField(The)`
Adds a new line to the List Field
Parameters:

`The <Any>` - initial value of the subfield to create

Returns:

`<inputEx.Field>` instance of the created field (inputEx.Field or derivative)

#### setOptions

`setOptions(options)`
Set the ListField classname
Parameters:

`options <Object>` - Options object (inputEx inputParams) as passed to the constructor

#### setValue

`setValue(value[,sendUpdatedEvt])`
Set the value of all the subfields
Parameters:

`value <Array>` - The list of values to set

`sendUpdatedEvt <boolean>` optional - (optional) Wether this setValue should fire the updatedEvt or not (default is true, pass false to NOT send the event)

#### validate

`<Boolean> validate()`
Validate each field
Returns:

`<Boolean>` true if all fields validate, required fields are not empty and unique constraint (if specified) is not violated

#### Methods inherited from class inputEx.Field:

`focus, getEl, fireUpdatedEvt, show, close, onBlur, onFocus, getStateString, setClassFromState, disable, onChange, render, updatedEvt, getState, hide, displayMessage, destroy, isEmpty, enable, clear,`

Copyright (c) 2007-2009 Eric Abouaf. All rights reserved.
Generated by JsDoc Toolkit 2.0.0 on Wed, 04 Mar 2009 15:41:31 GMT using neyricjslibs-template.