new CellEditor(grid, options)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
grid |
|||
options |
CellEvent | Properties listed below + arbitrary mustache "variables" for merging into template. |
|
options.editPoint |
Point | Deprecated; use |
|
options.format |
string |
<optional> |
Name of a localizer with which to override prototype's |
Members
checkEditorPositionFlag :boolean
if true, check that the editor is in the right location
Type:
- boolean
- Default Value:
- false
selectAll
select everything
Methods
checkEditor()
check that the editor is in the correct location, and is showing/hidden appropriately
errorEffectBegin(erroropt)
Calls the effect function indicated in the feedbackEffect
property, which triggers a series of CSS transitions.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
error |
boolean | string | Error |
<optional> |
If defined, call the |
getEditorValue(str) → {object}
Extract the edited value from the editor.
De-format the edited string back into a primitive value.
The localizer's parse
method will be called on the text box contents.
Override this method if your editor has additional or alternative GUI elements. The GUI elements will influence the primitive value, either by altering the edited string before it is parsed, or by transforming the parsed value before returning it.
Parameters:
Name | Type | Description |
---|---|---|
str |
string | current editors input string |
Throws:
-
Throws an error on parse failure. If the error's
message
is defined, the message will eventually be displayed (everyfeedbackCount
th attempt). - Type
- boolean | string | Error
Returns:
the current editor's value
- Type
- object
gridRenderedNotification()
This function is a callback from the fin-hypergrid. It is called after each paint of the canvas.
hideEditor()
hide the editor
moveEditor()
move the editor to the current editor point
saveEditorValue() → {boolean}
save the new value into the behavior (model)
Returns:
Data changed and pre-cell-edit event was not canceled.
- Type
- boolean
scrollValueChangedNotification()
scroll values have changed, we've been notified
setBounds(rectangle)
set the bounds of my input control
Parameters:
Name | Type | Description |
---|---|---|
rectangle |
rectangle | the bounds to move to |
setEditorValue(value)
Put the value into our editor.
Formats the value and displays it.
The localizer's format
method will be called.
Override this method if your editor has additional or alternative GUI elements.
Parameters:
Name | Type | Description |
---|---|---|
value |
object | The raw unformatted value from the data source that we want to edit. |
showEditor()
display the editor
stopEditing(feedbackopt) → {boolean}
Stops editing.
Before saving, validates the edited value in two phases as follows:
- Call
validateEditorValue
. (Calls the localizer'sinvalid()
function, if available.) - Catch any errors thrown by the
getEditorValue
method.
If the edited value passes both phases of the validation:
Saves the edited value by calling the saveEditorValue
method.
On validation failure:
- If
feedback
was omitted, cancels editing, discarding the edited value. - If
feedback
was provided, gives the user some feedback (seefeedback
, below).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
feedback |
number |
<optional> |
What to do on validation failure. One of:
|
Returns:
Truthy means successful stop. Falsy means syntax error prevented stop. Note that editing is canceled when no feedback requested and successful stop includes (successful) cancel.
- Type
- boolean
takeFocus()
Request focus for my input control.
See GRID-95 "Scrollbar moves inward" for issue and work-around explanation.
validateEditorValue(str) → {boolean|string}
If there is no validator on the localizer, returns falsy (not invalid; possibly valid).
Parameters:
Name | Type | Description |
---|---|---|
str |
string | current editors input string |
Throws:
-
May throw an error on syntax failure as an alternative to returning truthy. Define the error's
message
field as an alternative to returning string. - Type
- boolean | string | Error
Returns:
Truthy value means invalid. If a string, this will be an error message. If not a string, it merely indicates a generic invalid result.
- Type
- boolean | string