# Yahoo! UI Library

### DataTable Widget 2.7.0

Yahoo! UI Library > datatable > YAHOO.widget.BaseCellEditor
Search:
Filters Show Private Show Protected Show Deprecated

## Class YAHOO.widget.BaseCellEditor - uses YAHOO.util.EventProvider

Known Subclasses:
  YAHOO.widget.CellEditor YAHOO.widget.DropdownCellEditor YAHOO.widget.TextboxCellEditor YAHOO.widget.TextareaCellEditor YAHOO.widget.DateCellEditor YAHOO.widget.CheckboxCellEditor YAHOO.widget.RadioCellEditor

The BaseCellEditor class provides base functionality common to all inline cell editors for a DataTable widget.

### Constructor

YAHOO.widget.BaseCellEditor `( sType , oConfigs )`

Parameters:
  `sType <String>` Type indicator, to map to YAHOO.widget.DataTable.Editors.
  `oConfigs <Object>` (Optional) Object literal of configs.

### Properties

#### _elCancelBtn - `private HTMLElement`

Reference to Cancel button, if available.
Default Value: null

#### _elContainer - `private HTMLElement`

Container for inline editor.

#### _elSaveBtn - `private HTMLElement`

Reference to Save button, if available.
Default Value: null

#### _elTd - `private HTMLElement`

TD element.
Default Value: null

#### _oColumn - `private YAHOO.widget.Column`

Column instance.
Default Value: null

#### _oDataTable - `private YAHOO.widget.DataTable`

DataTable instance.

#### _oRecord - `private YAHOO.widget.Record`

Record instance.
Default Value: null

#### _sId - `private String`

Unique id assigned to instance "yui-ceditorN", useful prefix for generating unique DOM ID strings and log messages.

#### _sType - `private String`

Editor type.

#### asyncSubmitter - `HTMLFunction`

Implementer defined function that can submit the input value to a server. This function must accept the arguments fnCallback and oNewValue. When the submission is complete, the function must also call fnCallback(bSuccess, oNewValue) to finish the save routine in the CellEditor. This function can also be used to perform extra validation or input value manipulation.

#### CellEditor._nCount - `private static Number`

Global instance counter.
Default Value: 0

#### CellEditor.CLASS_CELLEDITOR - `static String`

Class applied to CellEditor container.
Default Value: "yui-ceditor"

#### defaultValue - `MIXED`

Default value in case Record data is undefined. NB: Null values will not trigger the default value.
Default Value: null

#### disableBtns - `Boolean`

True if Save/Cancel buttons should not be displayed in the CellEditor.
Default Value: false

#### isActive - `Boolean`

True if currently active.

#### LABEL_CANCEL - `String`

Text to display on Cancel button.
Default Value: "Cancel"

#### LABEL_SAVE - `String`

Text to display on Save button.
Default Value: "Save"

#### resetInvalidData - `Boolean`

If validation is enabled, resets input field of invalid data.
Default Value: true

#### validator - `HTMLFunction`

Validator function for input data, called from the DataTable instance scope, receives the arguments (inputValue, currentValue, editorInstance) and returns either the validated (or type-converted) value or undefined.
Default Value: null

#### value - `MIXED`

Current value.

### Methods

#### _initConfigs

`private void _initConfigs ( )`
Initialize configs.

Returns: `void`

#### _initEvents

`private void _initEvents ( )`
Initialize Custom Events.

Returns: `void`

#### attach

`void attach ( oDataTable , elCell )`
Attach CellEditor for a new interaction.

Parameters:
  `oDataTable <YAHOO.widget.DataTable>` Associated DataTable instance.
  `elCell <HTMLElement>` Cell to edit.

Returns: `void`

#### block

`void block ( )`
Fires blockEvent

Returns: `void`

#### cancel

`void cancel ( )`
Cancels CellEditor input and hides UI.

Returns: `void`

#### destroy

`void destroy ( )`
Nulls out the entire CellEditor instance and related objects, removes attached event listeners, and clears out DOM elements inside the container, removes container from the DOM.

Returns: `void`

#### doAfterRender

`void doAfterRender ( )`
Access to add additional event listeners.

Returns: `void`

#### focus

`void focus ( )`
Sets focus in CellEditor.

Returns: `void`

#### getColumn

`YAHOO.widget.Column getColumn ( )`
Returns reference to associated Column instance.

Returns: `YAHOO.widget.Column`
  Column instance.

#### getContainerEl

`HTMLElement getContainerEl ( )`
Returns container element.

Returns: `HTMLElement`
  Reference to container element.

#### getDataTable

`YAHOO.widget.DataTable getDataTable ( )`
Returns reference to associated DataTable instance.

Returns: `YAHOO.widget.DataTable`
  DataTable instance.

#### getId

`String getId ( )`
CellEditor unique ID.

Returns: `String`
  Unique ID of the CellEditor instance.

#### getInputValue

`void getInputValue ( )`
Retrieves input value from CellEditor.

Returns: `void`

#### getRecord

`YAHOO.widget.Record getRecord ( )`
Returns reference to associated Record instance.

Returns: `YAHOO.widget.Record`
  Record instance.

#### getTdEl

`HTMLElement getTdEl ( )`
Returns reference to associated TD element.

Returns: `HTMLElement`
  TD element.

#### handleDisabledBtns

`void handleDisabledBtns ( )`
After rendering form, if disabledBtns is set to true, then sets up a mechanism to save input without them.

Returns: `void`

#### move

`void move ( )`
Moves container into position for display.

Returns: `void`

#### render

`void render ( )`
Renders DOM elements and attaches event listeners.

Returns: `void`

#### renderBtns

`void renderBtns ( )`
Renders Save/Cancel buttons.

Returns: `void`

#### renderForm

`void renderForm ( )`
Renders form elements.

Returns: `void`

#### resetForm

`void resetForm ( )`
Resets CellEditor UI to initial state.

Returns: `void`

#### save

`void save ( )`
Saves value of CellEditor and hides UI.

Returns: `void`

#### show

`void show ( )`
Displays CellEditor UI in the correct position.

Returns: `void`

#### toString

`String toString ( )`
CellEditor instance name, for logging.

Returns: `String`
  Unique name of the CellEditor instance.

#### unblock

`void unblock ( )`
Fires unblockEvent

Returns: `void`

### Events

#### blurEvent

`blurEvent ( oArgs.editor )`
Fired when a CellEditor has a blur event.

Parameters:
  `oArgs.editor <YAHOO.widget.CellEditor>` The CellEditor instance.

#### cancelEvent

`cancelEvent ( oArgs.editor )`
Fired when a CellEditor input is canceled.

Parameters:
  `oArgs.editor <YAHOO.widget.CellEditor>` The CellEditor instance.

#### invalidDataEvent

`invalidDataEvent ( oArgs.editor , oArgs.newData , oArgs.oldData )`
Fired when a CellEditor input is reverted due to invalid data.

Parameters:
  `oArgs.editor <YAHOO.widget.CellEditor>` The CellEditor instance.
  `oArgs.newData <Object>` New data value from form input field.
  `oArgs.oldData <Object>` Old data value.

#### keydownEvent

`keydownEvent ( oArgs.editor , oArgs.event )`
Fired when a CellEditor has a keydown.

Parameters:
  `oArgs.editor <YAHOO.widget.CellEditor>` The CellEditor instance.
  `oArgs.event <HTMLEvent>` The event object.

#### revertEvent

`revertEvent ( oArgs.editor , oArgs.newData , oArgs.oldData )`
Fired when a CellEditor input is reverted due to asyncSubmitter failure.

Parameters:
  `oArgs.editor <YAHOO.widget.CellEditor>` The CellEditor instance.
  `oArgs.newData <Object>` New data value from form input field.
  `oArgs.oldData <Object>` Old data value.

#### saveEvent

`saveEvent ( oArgs.editor , oArgs.newData , oArgs.oldData )`
Fired when a CellEditor input is saved.

Parameters:
  `oArgs.editor <YAHOO.widget.CellEditor>` The CellEditor instance.
  `oArgs.newData <Object>` New data value from form input field.
  `oArgs.oldData <Object>` Old data value.

#### showEvent

`showEvent ( oArgs.editor )`
Fired when a CellEditor is shown.

Parameters:
  `oArgs.editor <YAHOO.widget.CellEditor>` The CellEditor instance.

Copyright © 2009 Yahoo! Inc. All rights reserved.