RealGrid2 API
Interface
CheckCellRenderer

CheckCellRenderer

A renderer that indicates whether a value is true or false.

Signature:

export interface CheckCellRenderer extends CellRenderer

Extends: CellRenderer

Remarks

This is a renderer that displays the cell value in two states: true/false.

If the data type of the field connected to the column is not Boolean, the values specified in trueValues of the renderer are set to true, and the values specified in falseValues are set to false is judged.

TOP_EDGE and BOTTOM_EDGE cannot be used in auto height.

[Superclass]

CellRenderer

Example

//string type
column.renderer = 'check';
 
//object type
column.renderer = {
      "type": "check",
      "trueValues": "France,Germany",
      "falseValues": "Korea,England"
}

Events

Events

PropertyTypeDescription
getCheckedCallbackGetCheckedCallbackA callback that determines the check value when rendering
setCheckedCallbackSetCheckedCallbackA callback that determines the check result value when editing

Properties

PropertyTypeDescription
checkLocationIconLocationLocation of checkbox
editablebooleanWhether or not it can be modified with an editor independently of the check mark
enterKeybooleanWhether to enable checking with enterKey
falseValuesstringValues to be considered false in fields that are not of type boolean
readOnlySetDisabledbooleanWhether to display as disabled when editable is false
showInnerFocusbooleanWhether to display internal focus when selected
spaceKeybooleanWhether to enable space bar checking
strictValuebooleanWhether to display in intermediate state if there are no values belonging to boolean data type and trueValues or falseValues
threeStatesbooleanWhether to include intermediate state
trueValuesstringValues to be considered true in fields that are not of type boolean
type'check'Type: Check
useImagesbooleanWhether to use images instead of checkboxes

Event Desc

getCheckedCallback

A callback that determines the check value when rendering

Type - GetCheckedCallback

Remarks:

When true is returned, the check value is considered false.

If not specified or when undefined is returned, the check value is considered true.

When returning false, if threeStates is true, the check value is considered undefined; otherwise, it is considered true.

The return value will affect the checked value unless setCheckedCallback is specified.

It follows the format of GetCheckedCallback.

Example:

const f = function(grid, itemIndex, column, value) {
 if (typeof value === "number") {
 return value % 2 === 1;
 }
 else if (typeof value ==="boolean") {
 return value;
 }
 else {
 return Boolean(v);
 }
}
 
column.renderer = {
 "type": "check",
 "getCheckedCallback": f
}

setCheckedCallback

Callback that determines the check result value when editing

Type - SetCheckedCallback

Remarks:

When editing, specify the checked value in priority over getCheckedCallback.

It follows the format of SetCheckedCallback.

Example:

const f = function(grid, itemIndex, column, oldValue, checked) {
 if (itemIndex % 2 === 0) {
    return checked;
 } else {
    return false;
 }
}
column.renderer = {
    "type": "check",
    "setCheckedCallback": f
}

Properties Desc

checkLocation

Location of checkbox

Type - IconLocation


editable

Whether or not it can be edited with an editor, regardless of the check mark

Type - boolean


enterKey

Whether to enable checking with enterKey

Type - boolean


falseValues

Values to be considered false in fields that are not of type boolean

Type - string

Remarks:

Enter separated by commas (,).

Example:

column.renderer = {
 "type": "check",
 "falseValues": "Korea,England"
}

readOnlySetDisabled

Whether to display as disabled when editable is false

Type - boolean


showInnerFocus

Whether to display internal focus when selected

Type - boolean


spaceKey

Whether to enable checking with the space bar

Type - boolean


strictValue

Whether to display in intermediate state if there are no values belonging to the boolean data type and trueValues or falseValues.

Type - boolean

Remarks:

If threeStates is true and the value is not included in trueValues or falseValues, it is displayed as an intermediate state.


threeStates

Whether to include intermediate state

Type - boolean

Remarks:

If used with strictValue or if the value is '', undefined, or null, it is considered to be in an intermediate state.


trueValues

Values to be considered true in fields that are not of type boolean

Type - string

Remarks:

Enter separated by commas (,).

Example:

column.renderer = {
 "type": "check",
 "trueValues": "France,Germany"
}

type

Type: Check

Type - 'check'


useImages

Whether to use images instead of checkboxes

Type - boolean

Remarks:

Just specify an image for each CSS class.

[list of css style names]

check true style name: "rg-check-renderer-checked"

check false style name: "rg-check-renderer-unchecked"

intermediate style name: "rg-check-renderer-intermediate"