Skip to main content

DomainObjectHandler<T>

Defined in: js-api/src/domains-ui.ts:107

The per-table ObjectHandler for domain rows: reflective (it takes columns, labels, choices and capabilities from the runtime registry, so it works on ANY table without codegen) and delegating (every render member falls through to the platform's Dart meta for that table).

class IssueHandler extends DG.DomainObjectHandler {
constructor() { super('grit.issue'); }
renderCard(x) { return ui.divText(`#${x.values.number} ${x.values.title}`); }
}
DG.ObjectHandler.register(new IssueHandler());

Dispatch precedence (unchanged by this class):

  1. Rendering — the last-registered JS handler applicable to the object wins ObjectHandler.forEntity; the platform's per-table meta demotes itself behind it regardless of registration order.
  2. Overriding nothing is never a regression — an override-nothing subclass renders exactly like the platform, because the defaults below delegate to the same Dart meta the platform would have used.
  3. Platform commands stay — Edit/Delete/Share/Watch/History context-menu commands remain the platform's, permission-gated; a JS handler ADDS actions (registerParamFunc), it never replaces those.
  4. Grid cells keyed by semType keep their registered cell renderer.

Extends

Type Parameters

Type ParameterDefault type
TDomainRow

Constructors

Constructor

new DomainObjectHandler<T>(table): DomainObjectHandler<T>

Defined in: js-api/src/domains-ui.ts:116

[table] addresses the domain table as '<schema>.<table>' (also the row entity type and semType); a malformed address throws immediately.

Parameters

ParameterType
tablestring

Returns

DomainObjectHandler<T>

Overrides

ObjectHandler.constructor

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
dartpublicany-ObjectHandler.dartjs-api/ui.ts:1688
schemaNamereadonlystringDomain schema name of table.-js-api/src/domains-ui.ts:109
tablereadonlystring--js-api/src/domains-ui.ts:116
tableNamereadonlystringTable name of table within schemaName.-js-api/src/domains-ui.ts:111

Accessors

client

Get Signature

get protected client(): DomainTableClient

Defined in: js-api/src/domains-ui.ts:191

Client for this table (grok.dapi.domains.table(this.table)).

Returns

DomainTableClient


dartMeta

Get Signature

get protected dartMeta(): EntityMetaDartProxy | null

Defined in: js-api/src/domains-ui.ts:177

The platform's per-table meta, as an EntityMetaDartProxy — what the default render members delegate to. Never a JS handler (delegating into one would recurse); null only for a table whose address cannot be parsed. Only a real hit is cached: a miss is re-resolved on the next use, so a handler constructed before the platform metas exist starts delegating as soon as they do.

Returns

EntityMetaDartProxy | null


helpUrl

Get Signature

get helpUrl(): string | null

Defined in: js-api/ui.ts:1695

URL of help page for the object that this meta handles.

Returns

string | null

Inherited from

ObjectHandler.helpUrl


markupRegexp

Get Signature

get markupRegexp(): string | null

Defined in: js-api/ui.ts:1840

Creates a regexp for detecting markup descriptions of an object

Returns

string | null

Inherited from

ObjectHandler.markupRegexp


name

Get Signature

get name(): string

Defined in: js-api/ui.ts:1699

Returns

string

Inherited from

ObjectHandler.name


regexpExample

Get Signature

get regexpExample(): { example: string; nonVariablePart: string; regexpMarkup: string; } | null

Defined in: js-api/ui.ts:1708

Will be used by search providers to get suggestions (like chembl which has regexp matcher) For something like CHEMBL object handler, it should return: regexpMarkup: 'CHEMBL[0-9]+', example: 'CHEMBL1234', nonVariablePart: 'CHEMBL'

Returns

{ example: string; nonVariablePart: string; regexpMarkup: string; } | null

Inherited from

ObjectHandler.regexpExample


type

Get Signature

get type(): string

Defined in: js-api/src/domains-ui.ts:123

Type of the object that this meta handles.

Returns

string

Overrides

ObjectHandler.type

Methods

auditPane()

auditPane(x): HTMLElement

Defined in: js-api/src/domains-ui.ts:445

The row's audit history as an embeddable element (the History pane of the built-in context panel).

Parameters

ParameterType
xT

Returns

HTMLElement


capabilities()

capabilities(): Promise<DomainTableCapabilities>

Defined in: js-api/src/domains-ui.ts:208

Effective DomainTableCapabilities of the current user on this table. Every affordance below is derived from it — consumers never hand-wire permission checks.

Returns

Promise<DomainTableCapabilities>


cloneRow()

cloneRow(x): Promise<boolean>

Defined in: js-api/src/domains-ui.ts:431

Opens the platform's create dialog prefilled from [x].

Parameters

ParameterType
xT

Returns

Promise<boolean>


copyLink(x): void

Defined in: js-api/src/domains-ui.ts:419

Copies the row's deepLink to the clipboard (with the platform's confirmation balloon).

Parameters

ParameterType
xT

Returns

void


deepLink(x): string | null

Defined in: js-api/src/domains-ui.ts:245

Permalink to the row's Entity View (business-key URL when unambiguous, id URL otherwise — the platform's own rule); null for an unsaved row (newRow), which has no address yet.

Parameters

ParameterType
xT

Returns

string | null


deleteRow()

deleteRow(x): Promise<boolean>

Defined in: js-api/src/domains-ui.ts:434

Deletes [x] after the standard confirmation.

Parameters

ParameterType
xT

Returns

Promise<boolean>


editRow()

editRow(x?): Promise<boolean>

Defined in: js-api/src/domains-ui.ts:425

Opens the platform's edit dialog for [x] — its create dialog when [x] is omitted or unsaved; resolves to whether a row was saved.

Parameters

ParameterType
x?T

Returns

Promise<boolean>


fromMarkup()

fromMarkup(matches): any

Defined in: js-api/ui.ts:1835

Extract object from parsed markup description

Parameters

ParameterType
matchesstring[]

Returns

any

Inherited from

ObjectHandler.fromMarkup


getById()

getById(id): Promise<T | null>

Defined in: js-api/src/domains-ui.ts:214

Loads the row by id (the acquisition path for a DomainRow in JS); null when it does not exist or is not visible.

Parameters

ParameterType
idstring

Returns

Promise<T | null>

Overrides

ObjectHandler.getById


getCanvasRenderer()

getCanvasRenderer(): CanvasRenderer | null

Defined in: js-api/ui.ts:1735

Returns

CanvasRenderer | null

Inherited from

ObjectHandler.getCanvasRenderer


getCaption()

getCaption(x): string

Defined in: js-api/src/domains-ui.ts:257

String representation of the [item], by default item.toString().

Parameters

ParameterTypeDescription
xTitem

Returns

string

Overrides

ObjectHandler.getCaption


getDetailTabs()

getDetailTabs(x): Promise<DomainDetailTab[]>

Defined in: js-api/src/domains-ui.ts:334

FK-inverted child tables scoped to [x] — the child tabs the built-in Entity View shows. Empty for an unsaved row or a table nothing references.

Parameters

ParameterType
xT

Returns

Promise<DomainDetailTab[]>


getGridCellRenderer()

getGridCellRenderer(): GridCellRenderer<any> | null

Defined in: js-api/ui.ts:1740

Returns

GridCellRenderer<any> | null

Inherited from

ObjectHandler.getGridCellRenderer


getProperties()

getProperties(): Promise<Property[]>

Defined in: js-api/src/domains-ui.ts:201

Runtime Property metadata of the table's declared columns (type, semType, choices, min/max, nullable, friendly label), bound to DomainRow values. Rejects with a DomainValidationError for a table that is not registered.

Returns

Promise<Property[]>


getRibbonActions()

getRibbonActions(x): Promise<DomainAction[]>

Defined in: js-api/src/domains-ui.ts:374

Actions available on [x] for the CURRENT user — the JS mirror of the Entity View ribbon plus its default Open action (Open, Edit, Clone, Delete, Share, Watch, History, Copy link), gated by server-truth row permissions (DomainRow.permissions) and the table's registry metadata. Actions the user may not perform are absent from the list; an unsaved row (newRow) has none of them — it has no address, history or permissions until it is inserted.

The dialog-backed runs delegate to editRow / cloneRow / deleteRow / shareRow / showHistory — override one of those to replace a flow, the action list stays the platform's.

Every action declares DomainAction.changesRow: the platform knows which of its own actions write, so a consumer reloads on it instead of guessing from the caption (which changes with the state: 'Watch' ⇄ 'Unwatch') or from the icon.

Parameters

ParameterType
xT

Returns

Promise<DomainAction[]>


init()

init(): void

Defined in: js-api/ui.ts:1845

Gets called once upon the registration of meta export class.

Returns

void

Inherited from

ObjectHandler.init


isApplicable()

isApplicable(x): boolean

Defined in: js-api/src/domains-ui.ts:127

Claims rows of table, including ones wrapped in a SemanticValue (how the platform passes cell values around).

Parameters

ParameterType
xany

Returns

boolean

Overrides

ObjectHandler.isApplicable


newRow()

newRow(): DomainRow

Defined in: js-api/src/domains-ui.ts:222

A new, unsaved row of this table — what renderEditor binds to when called without an object. Insert it with grok.dapi.domains.table(...).insert(row.values).

Returns

DomainRow


openRow()

openRow(x): void

Defined in: js-api/src/domains-ui.ts:251

Opens the row's Entity View — the platform's default (double-click) action for a domain row.

Parameters

ParameterType
xT

Returns

void


pickRow()

pickRow(options?): Promise<DomainRow | null>

Defined in: js-api/src/domains-ui.ts:450

Opens the platform's row picker for this table; resolves to the picked row or null. With [options.anchor] it is the drop-down flavour (see DomainObjectHandler.pickRow).

Parameters

ParameterType
options?DomainPickerOptions

Returns

Promise<DomainRow | null>


refresh()

refresh(x): Promise<T>

Defined in: js-api/ui.ts:1716

Parameters

ParameterType
xT

Returns

Promise<T>

Inherited from

ObjectHandler.refresh


registerParamFunc()

registerParamFunc(name, run): void

Defined in: js-api/ui.ts:1893

Registers a function that takes applicable objects as the only argument. It will be suggested to run in the context menu for that object, and also in the "Actions" pane on the context panel.

Example: https://public.datagrok.ai/js/samples/ui/docking/docking

Parameters

ParameterTypeDescription
namestringfunction name
run(param) => anya function that takes exactly one parameter

Returns

void

Inherited from

ObjectHandler.registerParamFunc


renderCard()

renderCard(x, context?): HTMLElement

Defined in: js-api/src/domains-ui.ts:275

Renders card div for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement

Overrides

ObjectHandler.renderCard


renderEditor()

renderEditor(x?): Promise<HTMLElement>

Defined in: js-api/src/domains-ui.ts:318

Reflective property form over the writable columns of [x] (a new row when omitted) — inputs come from getProperties, and non-writable columns are excluded from the form AND from any payload built off it, mirroring column security. Callers without the corresponding table capability (canInsert for a new row, canEdit for an existing one) get a read-only explanation instead: column security alone is NOT table Edit. A richer form (async validation, reference pickers, error mapping) is DomainForm in @datagrok-libraries/domain-ui.

Parameters

ParameterType
x?T

Returns

Promise<HTMLElement>


renderGrid()

renderGrid(grid, options?): void

Defined in: js-api/ui.ts:1817

Customizes a Grid presenting a collection of this handler's objects IN PLACE: column order/visibility, captions, cell renderers, interactivity. options.items is the DataFrame backing the grid when the caller wants the handler to tag or (re)bind it; when omitted, operate on grid.dataFrame.

Contract: derive presentation from column tags/semTypes only — the frame may be a pure data frame (e.g. a queryDf result) with NO hidden ~item object column; never assume one. Interactivity that needs the object goes through the semType renderer/context machinery.

Dispatch: OVERRIDING this member takes FULL responsibility for grid decoration of the built-in views (e.g. the Domain View grid). Any handler that does not override it — including one written against this version of the API — falls through to the platform meta for type, from EITHER side: the Dart dispatch skips the sentinel-marked base (see below), and the base itself delegates, so ObjectHandler.forEntity(x).renderGrid(grid) decorates exactly like the platform. To opt out of decoration entirely, override it with an empty body.

Parameters

ParameterType
gridGrid
options?{ items?: DataFrame; }
options.items?DataFrame

Returns

void

Inherited from

ObjectHandler.renderGrid


renderIcon()

renderIcon(x, context?): HTMLElement

Defined in: js-api/src/domains-ui.ts:263

Renders icon for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement

Overrides

ObjectHandler.renderIcon


renderInput()

renderInput(x, context?): InputBase<any> | null

Defined in: js-api/src/domains-ui.ts:285

Renders an input for the item (e.g. to be used in forms); null when the handler does not define one.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

InputBase<any> | null

Overrides

ObjectHandler.renderInput


renderListItem()

renderListItem(x, context?): HTMLDivElement

Defined in: js-api/src/domains-ui.ts:279

Renders the item as a list item — used when displaying objects in lists (such as wide html grids, or popups in type-ahead boxes). By default, renders the item's name.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLDivElement

Overrides

ObjectHandler.renderListItem


renderMarkup()

renderMarkup(x, context?): HTMLElement

Defined in: js-api/src/domains-ui.ts:267

Renders markup for the item. [context] says what the item is being rendered FOR, so one handler can serve several surfaces. The platform's many-to-many chips pass {relation, table, input: 'tags'} — the relation's name, the OWNER's '<schema>.<table>', and the widget kind. A chip's DG.DomainRow is a {id, displayName} stub with no column values, so read its name through getCaption(x) / x.displayNamex.values[nameColumn] is undefined there.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement

Overrides

ObjectHandler.renderMarkup


renderPreview()

renderPreview(x, params?, path?): Promise<View>

Defined in: js-api/src/domains-ui.ts:299

Renders preview list for the item.

Parameters

ParameterType
xT
params?any
path?string

Returns

Promise<View>

Overrides

ObjectHandler.renderPreview


renderProperties()

renderProperties(x, context?): HTMLElement

Defined in: js-api/src/domains-ui.ts:291

Renders properties list for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement

Overrides

ObjectHandler.renderProperties


renderTooltip()

renderTooltip(x, context?): HTMLElement

Defined in: js-api/src/domains-ui.ts:271

Renders tooltip for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement

Overrides

ObjectHandler.renderTooltip


renderView()

renderView(x, context?): HTMLElement

Defined in: js-api/src/domains-ui.ts:295

Renders view for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement

Overrides

ObjectHandler.renderView


rowFrom()

rowFrom(values): DomainRow

Defined in: js-api/src/domains-ui.ts:235

Wraps [values] — one row of a query() result — as a DomainRow of this table, locally and WITHOUT a round trip: the acquisition path a list, a card or a context panel uses to render, address and act on rows it already fetched (getById is the one that asks the server). Identity (displayName, semValue, deep links) resolves from the registry, so a row fetched without its business-key columns addresses itself by id. Anything but a plain values map (or null, for a new row) is REJECTED by name: read key by key, a string or an array produces a row of nonsense values that only shows up much later, as a card with no identity.

Parameters

ParameterType
values{[key: string]: any; } | null

Returns

DomainRow


rowOf()

protected rowOf(x): DomainRow | null

Defined in: js-api/src/domains-ui.ts:134

The DomainRow behind [x] (unwrapping a SemanticValue) when it belongs to this table, null otherwise. Use it in overrides instead of casting — handler members receive both shapes.

Parameters

ParameterType
xany

Returns

DomainRow | null


rowOrThrow()

protected rowOrThrow(x): DomainRow

Defined in: js-api/src/domains-ui.ts:143

rowOf, for the members that cannot act without a row: throws a named error naming the table instead of failing later on a null.

Parameters

ParameterType
xany

Returns

DomainRow


setWatch()

setWatch(x, value): Promise<boolean>

Defined in: js-api/src/domains-ui.ts:409

Subscribes/unsubscribes the current user to changes of [x]; resolves to the resulting state (the server refuses row watch on tables without an audit trail, and the state then stays unchanged).

Parameters

ParameterType
xT
valueboolean

Returns

Promise<boolean>


shareRow()

shareRow(x): Promise<void>

Defined in: js-api/src/domains-ui.ts:438

Opens the standard sharing flow for [x] (row-mode tables); resolves when the sharing dialog is SHOWN, not when sharing is done.

Parameters

ParameterType
xT

Returns

Promise<void>


showHistory()

showHistory(x): void

Defined in: js-api/src/domains-ui.ts:441

Shows the row's audit history in the platform's History dialog.

Parameters

ParameterType
xT

Returns

void


toMarkup()

toMarkup(T): string | null

Defined in: js-api/ui.ts:1830

Converts object to its markup description

Parameters

ParameterType
Tany

Returns

string | null

Inherited from

ObjectHandler.toMarkup


toString()

toString(): string

Defined in: js-api/ui.ts:1701

Returns

string

Inherited from

ObjectHandler.toString


auditPane()

static auditPane(row): HTMLElement

Defined in: js-api/src/domains-ui.ts:528

The row's audit trail as an embeddable element: who / when / what, newest first, with the field diff in each row's tooltip and a link opening the full event list as a table. Explains itself when the table has no audit trail.

Parameters

ParameterType
rowDomainRow

Returns

HTMLElement


cloneRow()

static cloneRow(row): Promise<boolean>

Defined in: js-api/src/domains-ui.ts:478

Opens the create dialog prefilled from [row] (writable columns only).

Parameters

ParameterType
rowDomainRow

Returns

Promise<boolean>


static copyLink(row): void

Defined in: js-api/src/domains-ui.ts:575

Copies [row]'s deepLink to the clipboard, with the platform's confirmation balloon; a no-op for an unsaved row.

Parameters

ParameterType
rowDomainRow | null

Returns

void


createRow()

static createRow(table): Promise<boolean>

Defined in: js-api/src/domains-ui.ts:465

Opens the platform's create dialog for [table] ('<schema>.<table>'); resolves to whether a row was saved. Inputs come from the registry, values are validated with the same code the server re-runs, columns the caller cannot write are absent from the form AND the payload.

Parameters

ParameterType
tablestring

Returns

Promise<boolean>


static deepLink(row): string | null

Defined in: js-api/src/domains-ui.ts:554

Permalink to [row]'s Entity View — the business-key URL when unambiguous, the id URL otherwise; null for an unsaved row, which has no address yet.

Parameters

ParameterType
rowDomainRow | null

Returns

string | null


deleteRow()

static deleteRow(row): Promise<boolean>

Defined in: js-api/src/domains-ui.ts:486

Deletes [row] after the platform's confirmation; resolves to whether it was deleted — false on cancel, and on a failed delete (a restrict violation, no Delete permission, a server error), which the platform reports in a balloon and then closes the dialog.

Parameters

ParameterType
rowDomainRow

Returns

Promise<boolean>


editRow()

static editRow(row): Promise<boolean>

Defined in: js-api/src/domains-ui.ts:473

Opens the platform's edit dialog for [row]; resolves to whether it was saved. A version conflict goes through the standard reload/overwrite dialog — reloading and saving in the reopened dialog still resolves true.

Parameters

ParameterType
rowDomainRow

Returns

Promise<boolean>


forEntity()

static forEntity(object, context?): ObjectHandler<any> | null

Defined in: js-api/ui.ts:1868

Parameters

ParameterTypeDefault value
objectanyundefined
contextanynull

Returns

ObjectHandler<any> | null

Inherited from

ObjectHandler.forEntity


forSemType()

static forSemType(semType): Promise<ObjectHandler<any>[]>

Defined in: js-api/ui.ts:1879

Parameters

ParameterType
semTypestring

Returns

Promise<ObjectHandler<any>[]>

Inherited from

ObjectHandler.forSemType


grantsPane()

static grantsPane(entityId, name?, options?): HTMLElement

Defined in: js-api/src/domains-ui.ts:542

Read-only grants pane of a REGISTRY entity — a schema, table or property schema id (DomainTable.id, grok.dapi.domains.registry), NOT a domain row: rows are shared through shareRow. Lists the direct permission rows plus a 'Manage access...' link ([options.readOnly] drops the link); listing requires Share, and non-Share callers get an explanation instead.

Parameters

ParameterType
entityIdstring
name?string
options?{ readOnly?: boolean; }
options.readOnly?boolean

Returns

HTMLElement


list()

static list(): ObjectHandler<any>[]

Defined in: js-api/ui.ts:1860

All registered handlers

Returns

ObjectHandler<any>[]

Inherited from

ObjectHandler.list


onResolve()

static onResolve(observer): Subscription

Defined in: js-api/ui.ts:1864

Parameters

ParameterType
observerPartialObserver<ObjectHandlerResolutionArgs>

Returns

Subscription

Inherited from

ObjectHandler.onResolve


openPath()

static openPath(path): void

Defined in: js-api/src/domains-ui.ts:569

Opens a /domains address through the platform's own navigation: row deep links, table views, and the scoped child-table views getDetailTabs produces. THE navigation entry point for domain addresses — do not re-spell it with grok.shell.route, which pushes history differently.

Parameters

ParameterType
pathstring

Returns

void


openRow()

static openRow(row): void

Defined in: js-api/src/domains-ui.ts:559

Opens [row]'s Entity View — the platform's default (double-click) action.

Parameters

ParameterType
rowDomainRow | null

Returns

void


pickRow()

static pickRow(table, options?): Promise<DomainRow | null>

Defined in: js-api/src/domains-ui.ts:510

Opens the platform's lookup picker for [table] ('<schema>.<table>') — the target table's Domain View with search and single select; resolves to the picked row, or null on cancel.

With [options.anchor] the picker is a headless DROP-DOWN: no caption or buttons, opening below the anchor element and right-aligned with it, closing on the item click that picks, on an outside click, and on ESC. Without it, the picker is the modal dialog (the flavour to keep for richer interactions).

Parameters

ParameterType
tablestring
options?DomainPickerOptions

Returns

Promise<DomainRow | null>


register()

static register(meta): void

Defined in: js-api/ui.ts:1848

Registers entity handler.

Parameters

ParameterType
metaObjectHandler

Returns

void

Inherited from

ObjectHandler.register


shareRow()

static shareRow(row): Promise<void>

Defined in: js-api/src/domains-ui.ts:496

Opens the standard sharing flow for [row]: the row is promoted to an entity (idempotent, needs Share on it) and the platform sharing dialog follows. Row-mode tables only — elsewhere access comes from the securing table, whose grants are grantsPane's subject. Resolves once the dialog is SHOWN (promotion done, permission denial already ballooned) — NOT when the user finishes sharing; subscribe to the platform's sharing events for that.

Parameters

ParameterType
rowDomainRow

Returns

Promise<void>


showConflictDialog()

static showConflictDialog(subject): Promise<"reload" | "overwrite" | null>

Defined in: js-api/src/domains-ui.ts:521

The standard optimistic-concurrency dialog for a 409, naming [subject] (the row's display value). Resolves to the user's decision — 'reload' (discard my changes, take the server's), 'overwrite' (retry against the current version), or null when the dialog is dismissed. The caller applies it; the platform's own editors resolve their conflicts through this same dialog.

Parameters

ParameterType
subjectstring

Returns

Promise<"reload" | "overwrite" | null>


showGrantsDialog()

static showGrantsDialog(entityId, name?): Promise<void>

Defined in: js-api/src/domains-ui.ts:548

The editable grants dialog for a registry entity (grant/revoke per group); resolves when it is shown.

Parameters

ParameterType
entityIdstring
name?string

Returns

Promise<void>


showHistory()

static showHistory(row): void

Defined in: js-api/src/domains-ui.ts:533

auditPane in the platform's History dialog.

Parameters

ParameterType
rowDomainRow

Returns

void