# Yahoo! UI Library

### DataTable Widget 2.9.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"

#### className - `String || String[]`

Custom CSS class or array of classes applied to the container element.

#### 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 - `HTML`

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

#### LABEL_SAVE - `HTML`

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

#### resetInvalidData - `Boolean`

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

#### useIFrame - `Boolean`

True if iframe shim for container element should be enabled.
Default Value: false

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

#### Properties inherited from YAHOO.util.EventProvider:

`__yui_events, __yui_subscribers`

### Methods

#### _hide

`void _hide ( )`
Hides CellEditor UI at end of interaction.

#### _initConfigs

`private void _initConfigs ( )`
Initialize configs.

#### _initContainerEl

`private void _initContainerEl ( )`
Initialize container element.

#### _initEvents

`private void _initEvents ( )`
Initialize Custom Events.

#### _initShimEl

`private void _initShimEl ( )`
Initialize container shim element.

#### attach

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

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

#### block

`void block ( )`
Fires blockEvent

#### cancel

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

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

#### doAfterRender

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

#### focus

`void focus ( )`
Sets focus in CellEditor.

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

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

#### move

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

#### render

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

#### renderBtns

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

#### renderForm

`void renderForm ( )`
Renders form elements.

#### resetForm

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

#### save

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

#### show

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

#### toString

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

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

#### unblock

`void unblock ( )`
Fires unblockEvent

#### Methods inherited from YAHOO.util.EventProvider:

`createEvent, fireEvent, hasEvent, subscribe, unsubscribe, unsubscribeAll`

### 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 © 2011 Yahoo! Inc. All rights reserved.