Class: Slider

Slider

new Slider()

Extends

Members

checkEditorPositionFlag :boolean

if true, check that the editor is in the right location

Type:
  • boolean
Inherited From:
Default Value:
  • false

selectAll

select everything

Inherited From:

Methods

checkEditor()

check that the editor is in the correct location, and is showing/hidden appropriately

Inherited From:

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 errorEffectEnd method at the end of the last effect transition with this error.

Inherited From:

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

Inherited From:
Throws:

Throws an error on parse failure. If the error's message is defined, the message will eventually be displayed (every feedbackCountth 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.

Inherited From:

hideEditor()

hide the editor

Inherited From:

moveEditor()

move the editor to the current editor point

Inherited From:

paint()

Emerson's paint function for a slider button. currently the user cannot interact with it

Overrides:

roundRect(gc, x, y, width, height, radius, fill, stroke)

A simple implementation of rounding a cell.

Parameters:
Name Type Description
gc CanvasRenderingContext2D
x number

the x grid coordinate of my origin

y number

the y grid coordinate of my origin

width number

the width I'm allowed to draw within

height number

the height I'm allowed to draw within

radius number
fill number
stroke number
Inherited From:

saveEditorValue() → {boolean}

save the new value into the behavior (model)

Inherited From:
Returns:

Data changed and pre-cell-edit event was not canceled.

Type
boolean

scrollValueChangedNotification()

scroll values have changed, we've been notified

Inherited From:

setBounds(rectangle)

set the bounds of my input control

Parameters:
Name Type Description
rectangle rectangle

the bounds to move to

Inherited From:

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.

Inherited From:

showEditor()

display the editor

Inherited From:

stopEditing(feedbackopt) → {boolean}

Stops editing.

Before saving, validates the edited value in two phases as follows:

  1. Call validateEditorValue. (Calls the localizer's invalid() function, if available.)
  2. 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:

  1. If feedback was omitted, cancels editing, discarding the edited value.
  2. If feedback was provided, gives the user some feedback (see feedback, below).
Parameters:
Name Type Attributes Description
feedback number <optional>

What to do on validation failure. One of:

  • undefined - Do not show the error effect or the end effect. Just discard the value and close the editor (as if ESC had been typed).
  • 0 - Just shows the error effect (see the errorEffect property).
  • 1 - Shows the error feedback effect followed by the detailed explanation.
  • 2 or more:
    1. Shows the error feedback effect
    2. On every feedback tries, shows the detailed explanation.
  • If undefined (omitted), simply cancels editing without saving edited value.
  • If 0, shows the error feedback effect (see the errorEffect property).
  • If > 0, shows the error feedback effect and calls the errorEffectEnd method) every feedback call(s) to stopEditing.
Inherited From:
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.

Inherited From:

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

Inherited From:
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

Type Definitions

renderConfig

This is the renderer config object, which is:

  1. First passed to a getCell method implementation, which may override (most of) its values before returning.
  2. Then passed to the specified cell renderers' paint function for rendering.

Standard Properties

On each render of every visible cell, this a fresh instance of an object created from (whose prototype is) a properties object as defined by layer-props.js. It therefore has all the standard properties defined in module:defaults.

Additional Properties

In addition, the config object has the following additional properties.

Properties marked read-only may in fact be writable, but should be considered off limits to overriding. Do not attempt to change these properties inside a getCell method override.

Properties marked write-only are to be defined the cell renderer for use by the caller (the grid renderer).

Type:
  • object
Properties:
Name Type Attributes Description
config.allRowsSelected boolean
config.bounds BoundingRect

Bounding rect of the cell or subcell to be rendered.

config.clickRect object <optional>

Write-only. The Cell renderer may return in this property a subrect in the cell's local coordinates that represents a click region. If defined by the cell renderer, the CellClick feature will ignore clicks outside the click region. If not defined by the cell renderer, the entire cell is clickable.

config.dataCell dataCellCoords

Read-only. Data coordinates of the cell.

config.dataRow dataRowObject

Access to other column values in the same row.

config.formatValue function

For cell renderer use only. Not available in getCell override. The cell's value formatter function (based on the formatter name in config.format, as possibly mutated by getCell).

config.gridCell gridCellCoords

Read-only. Grid coordinates of the cell.

config.halign string

The cell's horizontal alignment property, as interpreted by it's cell renderer.

config.isCellHovered boolean

-

config.isCellSelected boolean

-

config.isColumnHovered boolean

-

config.isColumnSelected boolean

-

config.isDataColumn boolean

-

config.isDataRow boolean

-

config.isFilterRow boolean

-

config.isHandleColumn boolean

-

config.isHeaderRow boolean

-

config.isInCurrentSelectionRectangle boolean

-

config.isRowHovered boolean

-

config.isRowSelected boolean

-

config.isSelected boolean

-

config.isTreeColumn boolean

-

config.isUserDataArea boolean

-

config.minWidth number

Write-only. The Cell renderer should return the pixel width of the rendered contents in this property.

config.mouseDown boolean

The last mousedown event occurred over this cell and the mouse is still down. Note, however, that the mouse may no longer be hovering over this cell when it has been dragged away.

config.prefillColor <optional>

Write-only. This is the color already painted by the grid renderer behind the cell to be rendered. If the cell's specified background color is the same, renderer may (and should!) skip painting it. If undefined, this signals a "partial render"; cell renderers that support partial rendering can use config.snapshot to determine whether or not to rerender the cell.

config.snapshot object <optional>

Write-only. Supports partial render. In support of the by-cells "partial" grid renderer, cell renderers can save the essential render parameters in this property so that on subsequent calls, when the parameters are the same, cell renderers can skip the actual rendering. Only when the parameters have changed is the cell rendered and this property reset (with the new parameters). This object would typically include at the very least the (formatted) value, plus additional properties as needed to fully describe the appearance of the render, such as color, etc. This property is undefined the first time a cell is rendered by the by-cells grid renderer. See also the DataModel#configObject's prefillColor property.

config.value

Value to be rendered.

The renderer has available to it the .formatValue() function for formatting the value. The function comes from the localizer named in the .format property. If there is no localizer with that name, the function defaults to the string localizer's formatter (which simply invokes the value's toString() method).

Typically a Local primitive value, values can be any type, including objects and arrays. The specified cell renderer is expected to know how to determine the value's type and render it.

Inherited From:

Slider

new Slider()

Extends

Members

checkEditorPositionFlag :boolean

if true, check that the editor is in the right location

Type:
  • boolean
Inherited From:
Default Value:
  • false

selectAll

select everything

Inherited From:

Methods

checkEditor()

check that the editor is in the correct location, and is showing/hidden appropriately

Inherited From:

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 errorEffectEnd method at the end of the last effect transition with this error.

Inherited From:

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

Inherited From:
Throws:

Throws an error on parse failure. If the error's message is defined, the message will eventually be displayed (every feedbackCountth 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.

Inherited From:

hideEditor()

hide the editor

Inherited From:

moveEditor()

move the editor to the current editor point

Inherited From:

paint()

Emerson's paint function for a slider button. currently the user cannot interact with it

Overrides:

roundRect(gc, x, y, width, height, radius, fill, stroke)

A simple implementation of rounding a cell.

Parameters:
Name Type Description
gc CanvasRenderingContext2D
x number

the x grid coordinate of my origin

y number

the y grid coordinate of my origin

width number

the width I'm allowed to draw within

height number

the height I'm allowed to draw within

radius number
fill number
stroke number
Inherited From:

saveEditorValue() → {boolean}

save the new value into the behavior (model)

Inherited From:
Returns:

Data changed and pre-cell-edit event was not canceled.

Type
boolean

scrollValueChangedNotification()

scroll values have changed, we've been notified

Inherited From:

setBounds(rectangle)

set the bounds of my input control

Parameters:
Name Type Description
rectangle rectangle

the bounds to move to

Inherited From:

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.

Inherited From:

showEditor()

display the editor

Inherited From:

stopEditing(feedbackopt) → {boolean}

Stops editing.

Before saving, validates the edited value in two phases as follows:

  1. Call validateEditorValue. (Calls the localizer's invalid() function, if available.)
  2. 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:

  1. If feedback was omitted, cancels editing, discarding the edited value.
  2. If feedback was provided, gives the user some feedback (see feedback, below).
Parameters:
Name Type Attributes Description
feedback number <optional>

What to do on validation failure. One of:

  • undefined - Do not show the error effect or the end effect. Just discard the value and close the editor (as if ESC had been typed).
  • 0 - Just shows the error effect (see the errorEffect property).
  • 1 - Shows the error feedback effect followed by the detailed explanation.
  • 2 or more:
    1. Shows the error feedback effect
    2. On every feedback tries, shows the detailed explanation.
  • If undefined (omitted), simply cancels editing without saving edited value.
  • If 0, shows the error feedback effect (see the errorEffect property).
  • If > 0, shows the error feedback effect and calls the errorEffectEnd method) every feedback call(s) to stopEditing.
Inherited From:
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.

Inherited From:

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

Inherited From:
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

Type Definitions

renderConfig

This is the renderer config object, which is:

  1. First passed to a getCell method implementation, which may override (most of) its values before returning.
  2. Then passed to the specified cell renderers' paint function for rendering.

Standard Properties

On each render of every visible cell, this a fresh instance of an object created from (whose prototype is) a properties object as defined by layer-props.js. It therefore has all the standard properties defined in module:defaults.

Additional Properties

In addition, the config object has the following additional properties.

Properties marked read-only may in fact be writable, but should be considered off limits to overriding. Do not attempt to change these properties inside a getCell method override.

Properties marked write-only are to be defined the cell renderer for use by the caller (the grid renderer).

Type:
  • object
Properties:
Name Type Attributes Description
config.allRowsSelected boolean
config.bounds BoundingRect

Bounding rect of the cell or subcell to be rendered.

config.clickRect object <optional>

Write-only. The Cell renderer may return in this property a subrect in the cell's local coordinates that represents a click region. If defined by the cell renderer, the CellClick feature will ignore clicks outside the click region. If not defined by the cell renderer, the entire cell is clickable.

config.dataCell dataCellCoords

Read-only. Data coordinates of the cell.

config.dataRow dataRowObject

Access to other column values in the same row.

config.formatValue function

For cell renderer use only. Not available in getCell override. The cell's value formatter function (based on the formatter name in config.format, as possibly mutated by getCell).

config.gridCell gridCellCoords

Read-only. Grid coordinates of the cell.

config.halign string

The cell's horizontal alignment property, as interpreted by it's cell renderer.

config.isCellHovered boolean

-

config.isCellSelected boolean

-

config.isColumnHovered boolean

-

config.isColumnSelected boolean

-

config.isDataColumn boolean

-

config.isDataRow boolean

-

config.isFilterRow boolean

-

config.isHandleColumn boolean

-

config.isHeaderRow boolean

-

config.isInCurrentSelectionRectangle boolean

-

config.isRowHovered boolean

-

config.isRowSelected boolean

-

config.isSelected boolean

-

config.isTreeColumn boolean

-

config.isUserDataArea boolean

-

config.minWidth number

Write-only. The Cell renderer should return the pixel width of the rendered contents in this property.

config.mouseDown boolean

The last mousedown event occurred over this cell and the mouse is still down. Note, however, that the mouse may no longer be hovering over this cell when it has been dragged away.

config.prefillColor <optional>

Write-only. This is the color already painted by the grid renderer behind the cell to be rendered. If the cell's specified background color is the same, renderer may (and should!) skip painting it. If undefined, this signals a "partial render"; cell renderers that support partial rendering can use config.snapshot to determine whether or not to rerender the cell.

config.snapshot object <optional>

Write-only. Supports partial render. In support of the by-cells "partial" grid renderer, cell renderers can save the essential render parameters in this property so that on subsequent calls, when the parameters are the same, cell renderers can skip the actual rendering. Only when the parameters have changed is the cell rendered and this property reset (with the new parameters). This object would typically include at the very least the (formatted) value, plus additional properties as needed to fully describe the appearance of the render, such as color, etc. This property is undefined the first time a cell is rendered by the by-cells grid renderer. See also the DataModel#configObject's prefillColor property.

config.value

Value to be rendered.

The renderer has available to it the .formatValue() function for formatting the value. The function comes from the localizer named in the .format property. If there is no localizer with that name, the function defaults to the string localizer's formatter (which simply invokes the value's toString() method).

Typically a Local primitive value, values can be any type, including objects and arrays. The specified cell renderer is expected to know how to determine the value's type and render it.

Inherited From: