RealGrid2 API
Class
CustomCellRendererImpl

CustomCellRendererImpl

It is a parent class of user-defined renderer.

Signature:

export declare abstract class CustomCellRendererImpl extends DataCellRenderer

Extends: DataCellRenderer

Remarks

get styleName, _doInitContent, _doClearContent, render must be implemented.

Constructors

ConstructorModifiersDescription
(constructor)(type)Constructs a new instance of the CustomCellRendererImpl class

Properties

PropertyTypeDescription
clickOnlyFocusedCellbooleanIf true, the click event occurs only when the cell is to be focused or when the focus can be moved. CellRenderer.clickOnlyFocusedCell
domHTMLElement
gridGridBaseGrid object referenced by Renderer
indexCellIndexIndex of the cell referenced by the renderer
inputFocusableboolean
itemClickableboolean
refreshFocusChangedbooleanIf true, the cell is redrawn when focus is moved.
showTooltipbooleanTooltip visibility
styleNamestringRenderer class
typestringtype of renderer

Methods

MethodTypeDescription
_doClearContent(dom)protected abstract _doClearContent(dom: HTMLElement): void;Callback fired when Renderer is removed
_doEditClick(index, event, result)protected _doEditClick(index: CellIndex, event: MouseEvent, result: RendererEditResult): boolean ;
_doInitContent(dom)protected abstract _doInitContent(dom: HTMLElement): void;Callback that occurs when the renderer is first drawn
canClick(event)canClick(event: MouseEvent): boolean;Whether to use grid click event
canClickSpaceKey(event)canClickSpaceKey(event: Event): boolean;When a specific key is down, if true is returned, itemClick is called.
canEdit()canEdit(): boolean;Whether the renderer is editable
canEditClickAt(event)canEditClickAt(event: MouseEvent): boolean;Whether to change to edit state when a click occurs in an editable cell
click(index, event, target)click(index: CellIndex, event: Event, target?: HTMLElement): any;If the element is clickable when the element is clicked, ClickData is returned.
itemClick(event)itemClick(event: Event): void;Method called when true is returned in CustomCellRendererImpl.canClickSpaceKey()
preventDefaultClick(event)preventDefaultClick(event: Event): void;When the clicked element is a tag (anchor, etc.) with a basic action, the basic action is stopped.
preventDefaultEditClick(event)preventDefaultEditClick(event: MouseEvent): void;Used to stop basic operation when the clicked element is an editable tag.
render(grid, model, w, h, info)protected abstract render(grid: GridBase, model: GridCell, w: number, h: number, info: any): void;Callback to be executed when rendering
tooltip(model, index)tooltip(model: GridCell, index: CellIndex): string;

Construct Desc

(constructor)

Constructs a new instance of the CustomCellRendererImpl class


Properties Desc

clickOnlyFocusedCell

If true, the click event occurs only when the cell is to be focused or when the focus can be moved. CellRenderer.clickOnlyFocusedCell

Type - boolean


dom

Type - HTMLElement


grid

Grid object referenced by Renderer

Type - GridBase

Remarks:

It should not be overridden.


index

Index of the cell referenced by the renderer

Type - CellIndex

Remarks:

It should not be overridden.

It is slightly different from the interface exposed to the outside.


inputFocusable

Type - boolean


itemClickable

Type - boolean


refreshFocusChanged

If true, the cell is redrawn when focus is moved.

Type - boolean

Remarks:

Used when the cell needs to be updated when it has focus.


showTooltip

Whether to display tooltips

Type - boolean


styleName

Renderer class

Type - string

Remarks:

rg-renderer + Must return with a user-specified class name.


type

type of renderer

Type - string

Remarks:

The name used when registering with registerCustomerRenderer becomes the type.

It should not be overridden.


Method Desc

_doClearContent

Callback fired when the renderer is removed

Remarks:

Removes elements created in _doInitContent.


_doEditClick


_doInitContent

A callback that occurs when the renderer is first drawn.

[Parameter List]

dom - HTMLElement

parentElement

[Return Value] - void

Remarks:

Creates elements to be displayed on the actual screen and adds them to the passed dom.

In addition, it initializes internal properties to be used in the renderer.

When using addEventListener, you must remove it with removeEventListener in _doClearContent.


canClick

Whether to use grid click event

[Parameter List]

event - MouseEvent

mouse click event

[return value] - boolean

Remarks:

If you return false, the grid will not process the click event and will perform the element's basic action.


canClickSpaceKey

When a specific key is down, if true is returned, itemClick is called.

[Parameter List]

event - Event

keyboard event

[return value] - boolean

Remarks:

Use it to create the same flow as clicking with the mouse.


canEdit

Is the renderer editable?

Remarks:

If it is a renderer whose value changes by clicking, such as CheckCellRenderer, it returns true.


canEditClickAt

Whether to change to edit state when a click occurs in an editable cell

[Parameter List]

event - MouseEvent

mouse click event

[return value] - boolean

Remarks:

If true is returned, the status of the corresponding row is changed to editing.


click

If the element is clickable when the element is clicked, ClickData is returned.

[Parameter List]

index - CellIndex

Cell location information model

event - Event

mouse event

target - HTMLElement

clicked element

[return value] - any

Remarks:

The returned data is delivered to the GridBase.onCellItemClicked event.

When returning false, stop the event and call CustomCellRendererImpl.preventDefaultClick().


itemClick

Method called when true is returned in CustomCellRendererImpl.canClickSpaceKey()

[Parameter List]

event - Event

keyboard event

[Return Value] - void

Remarks:

Inside the grid, it is used to replace element click with the keyboard.


preventDefaultClick

When the clicked element is a tag (anchor, etc.) with a basic action, the basic action is stopped.

[Parameter List]

event - Event

mouse event

[Return Value] - void

Remarks:

Called when false is returned in GridBase.onCellItemClicked.


preventDefaultEditClick

Used to stop basic operation when the clicked element is an editable tag.

[Parameter List]

event - MouseEvent

mouse event

[Return Value] - void

Remarks:

When mouse and keyboard events occur, the grid processes them internally and stops event propagation.

When you click on a label like <input type='checkbox' id='test'/><label for='test'>test</label>

If clicking on the label and input occurs sequentially, it should not be stopped, so preventDefaultEditClick must be redefined to prevent it from stopping.


render

Callback to be executed when rendering

[Parameter List]

grid - GridBase

GridBaseControl

model - GridCell

GridCell object

w - number

width

h - number

height

info - any

[Return Value] - void

Remarks:

Called when the screen scrolls or data changes.

The renderer should not create or remove elements here because the actual location is not changed and is reused.

If possible, create all necessary elements in _doInitContent and only change properties such as style or text inside render.


tooltip

[Parameter List]

model - GridCell

GridCell object

index - CellIndex

Cell location information model

[return value] - string