RealGrid2 API
Class
RealGrid

RealGrid

RealGrid main class

Signature:

export default class RealGrid

Properties

PropertyTypeDescription
CustomCellRendererImpltypeof CustomCellRendererImpl
GridViewtypeof GridViewReturns GridView Class. See GridView
LocalDataProvidertypeof LocalDataProviderReturns LocalDataProvider Class. See LocalDataProvider
LocalTreeDataProvidertypeof LocalTreeDataProviderReturns LocalTreeDataProvider Class. See LocalTreeDataProvider
TreeViewtypeof TreeViewReturns TreeView Class. See TreeView

Methods

MethodTypeDescription
getActiveGrid()static getActiveGrid(): any;Returns the last selected grid.
getGridInstance(container)static getGridInstance(container: string | HTMLDivElement): any;Returns the grid owned by the entered element.
getVersion()static getVersion(): string;Check the version of the installed RealGrid module.
registerCustomRenderer(type, renderer, overwrite)static registerCustomRenderer(type: string, renderer: any, overwrite?: boolean): void;Register a custom renderer.
setDefault(options, dataOptions)static setDefault(options: ViewOptions, dataOptions?: DataOptions): void;Specifies grid preferences.
setIECompatMode(value)static setIECompatMode(value: boolean): void;Used when using the grid in IE mode using a browser extension.
setLicenseKey(key)static setLicenseKey(key: string): void;Enter the grid licenseKey.
setLocale(locale)static setLocale(locale: RealGridLocale): void;Register messages and numberFormat used in the grid.
setMobile(value)static setMobile(value: boolean): void;Ensure that the grid is created in mobile mode.
setSlotMode(value)static setSlotMode(value: boolean): void;Set when creating as a child of shadowDom or slot.
setTablet(value)static setTablet(value: boolean): void;Ensure that the grid is created in tablet mode.

Properties Desc

CustomCellRendererImpl

Type - typeof CustomCellRendererImpl


GridView

Returns GridView Class. See GridView

Type - typeof GridView


LocalDataProvider

Returns LocalDataProvider Class. See LocalDataProvider

Type - typeof LocalDataProvider


LocalTreeDataProvider

Returns LocalTreeDataProvider Class. See LocalTreeDataProvider

Type - typeof LocalTreeDataProvider


TreeView

Returns TreeView Class. See TreeView

Type - typeof TreeView


Method Desc

getActiveGrid

Returns the last selected grid.

Remarks:

Even if the currently selected element is not a grid, the last selected grid is returned.


getGridInstance

Returns the grid owned by the entered element.

[Parameter List]

container - string | HTMLDivElement

elementID or element used when creating the grid

[return value] - any


getVersion

Check the version of the installed RealGrid module.


registerCustomRenderer

Register a custom renderer.

[Parameter List]

type - string

User-specified renderer type (name)

renderer - any

CustomCellRenderer object

overwrite - boolean

If true, it replaces the previously defined renderer.

[Return Value] - void

Example:

// CustomCellRenderer model
gridView.registerCustomRenderer("renderer01", {
     initContent(parent) {
         var span = this._span = document.createElement("span");
         parent.append(span);
     }
})
// When creating a class.
class CustomSpanRenderer extends RealGrid.CustomCellRendererImpl {
     private _span: HTMLSpanElement; // Add properties that require a renderer.
     getstyleName() {
         return 'rg-renderer custom-span' // return class name
     }
     get refreshFocusChanged() {
         return true; // If focus changes, execute render again.
     }
     private spanClickHandler = (e: MouseEvent) => { // If you make it an arrow function, this refers to an instance of the class even if you do not bind it when addingEventListener.
     }
     protected _doInitContent(dom: HTMLElement): void {
         const span = this._span = document.createElement("span");
         span.addEventListener("click", this.spanClickHandler); // Must be removed.
         dom.appendChild(this._span);
     }
     protected _doClearContent(dom: HTMLElement): void {
         this._span.parentElement && this._span.parentElement.removeChild(this._span);
         this._span.removeEventListener("click", this.spanClickHandler);
     }
     protected render(grid: GridBase, model: GridCell, w: number, h: number, info: any): void {
         this._span.textContent = model.value || "";
         const css = this._span.style;
         css.removeProperty("color");
         if (info.focused) {
             css.color = "red"
         }
     }
}

setDefault

Set grid preferences.

[Parameter List]

options - ViewOptions

option object

dataOptions - DataOptions

dataProvider option object

[Return Value] - void

Remarks:

If specified in the same form as GridBase.setOptions(), it will be applied as the default setting for the grid created thereafter.


setIECompatMode

Use this when using the grid in IE mode using a browser extension.

[Parameter List]

value - boolean

boolean

[Return Value] - void

Remarks:

In IE mode of the extension, change pointerEvent to use mouseEvent. It must be set before the grid is created.


setLicenseKey

Enter the grid licenseKey.

Remarks:

Used when storing licenseKey in an environment variable.


setLocale

Register messages and numberFormat used in the grid.

[Parameter List]

locale - RealGridLocale

locale object

[Return Value] - void


setMobile

Ensure that the grid is created in mobile mode.

[Parameter List]

value - boolean

boolean

[Return Value] - void

Remarks:

If the grid cannot check the mobile state of the browser, change it to the mobile state using RealGrid.setMobile(true). This must be set before the grid is created.


setSlotMode

Set when creating as a child of shadowDom or slot.

[Parameter List]

value - boolean

boolean;

[Return Value] - void

Remarks:

Filter, listEditor, etc. are created inside the grid. Some functions such as drag&drop cannot be used.


setTablet

Ensure that the grid is created in tablet mode.

[Parameter List]

value - boolean

boolean;

[Return Value] - void

Remarks:

If you cannot confirm whether the device is a tablet, change it to tablet status using RealGrid.setTablet(true). This must be set before the grid is created.