inputEx Documentation Back to homepage

### inputEx Documentation > inputEx.ColorField 0.2.2

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

Create a Color picker input field

### Constructor

inputEx.ColorField `( options )`

Parameters:
  `options <Object>` - Added options for ColorField :
  - colors: list of colors to load as palette
  - palette: default palette to be used (if colors option not provided)
  - cellPerLine: how many colored cells in a row on the palette
  - ratio: screen-like ratio to display the palette, syntax: [with,height], default: [16,9] (if cellPerLine not provided)
  - overlayPadding: padding inside the popup palette
  - cellWidth: width of a colored cell
  - cellHeight: height of a colored cell
  - cellMargin: margin of a colored cell (cell spacing = 2*cellMarging)

### 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.

#### static palettes `- Object`

Default palettes

### Methods

#### close

`close()`
Call overlay when field is removed

#### ensureHexa

`static ensureHexa(color)`
Parameters:

`color`

#### getValue

`<String> getValue()`
Return the color value
Returns:

`<String>` Color value

#### onColorClick

`onColorClick(e)`
Handle a color selection
Parameters:

`e <Event>` - The original click event

#### renderColorGrid

`renderColorGrid()`
This creates a color grid

#### renderComponent

`renderComponent()`
Render the color button and the colorpicker popup

#### renderPalette

`renderPalette()`

#### setDefaultColors

`<Array> setDefaultColors(index)`
Set the colors to set in the picker
Parameters:

`index <int>` - Index of the palette to use

Returns:

`<Array>` List of colors to choose from

#### setOptions

`setOptions(options)`
Adds the 'inputEx-ColorField' default className
Parameters:

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

#### setValue

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

`value <String>` - Color 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)

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

`focus, getEl, validate, fireUpdatedEvt, show, onBlur, onFocus, getStateString, setClassFromState, disable, onChange, render, updatedEvt, initEvents, 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:30 GMT using neyricjslibs-template.