Print Friendly

# Class YAHOO.ext.grid.NumberEditor

Package: | YAHOO.ext.grid
Class: | NumberEditor
Extends: | CellEditor
Defined In: | NumberEditor.js

Provides a masked editor for numeric values. Invalid keys are ignored. It supports the following configuration options:

- allowDecimals - True if the cell can have decimal values.
- decimalSeparator - Character(s) to allow as the decimal separator.
- decimalPrecision - Set the maximum decimal precision.
- decimalPrecisionFcn - Define the function to call to remove extra precision (ie. Math.floor, Math.round, Math.ceil or your own function).
- allowNegative - True if the cell allows negative values.
- selectOnFocus - True to select the text when the editor is activated.
- minValue - The minimum value the cell will allow.
- maxValue - The maximum value the cell will allow.
- minText - The tooltip to display when the value in the cell is below the minimum.
- maxText - The tooltip to display when the value in the cell is above the maximum.
- nanText - The tooltip to display when the value in the cell is not a valid number (for example, negatives are allowed and the value in the cell is just "-" with no numbers).
- allowBlank - True if the cell is allowed to be empty.
- blankText - The tooltip (error message) to display when the cell is empty and is not allowed to be.
- validator - Any custom validation function you want called. The function must return true if the data is valid or an error message otherwise.
- validationDelay - The delay in milliseconds for validation. Each time the user types something the field is validated after a specified delay, setting this value allows you to customize that delay (for example, if your custom validation routine is slow).

For more information on using this editor, see this blog post.

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| NumberEditor(`Object config`) | NumberEditor
Create a new NumberEditor

## Public Events

This class has no public events.

## Constructor Details

### NumberEditor

`public function NumberEditor(`Object config`)`
Create a new NumberEditor
Parameters:

- `config` : Object

Copyright © 2006 Jack Slocum. All rights reserved.