Skip to main content

Dialog<Inputs>

A non-modal dialog. Sample: https://public.datagrok.ai/js/samples/ui/dialogs

Example

ui.dialog('Windows')
.add(ui.)
.add(ui.span(['People of Earth, your attention, please… ']))
.onOK(() => { grok.shell.info('OK!'); })
.show();

Extends

Extended by

Type parameters

Type parameterValue
Inputs extends Record<string, InputBase<any>>object

Constructors

new Dialog()

new Dialog<Inputs>(dart): Dialog<Inputs>

Parameters

ParameterType
dartany

Returns

Dialog<Inputs>

Overrides

DartWidget . constructor

Source

src/widgets.ts:711

Properties

PropertyModifierTypeDefault valueDescriptionInherited from
_functionsprotectedFunc[][]-DartWidget._functions
_propertiesprotectedProperty[][]-DartWidget._properties
_rootprotectedHTMLElementundefined-DartWidget._root
dartpublicanyundefined-DartWidget.dart
factorypublicnull | FuncnullConstructor function. No parameters, returns [Widget].DartWidget.factory
isDetachedpublicbooleanfalse-DartWidget.isDetached
propspublicanyundefined-DartWidget.props
subspublicSubscription[]undefined-DartWidget.subs
temppublicanyundefinedContains auxiliary informationDartWidget.temp

Accessors

children

get children(): Widget<any>[]

Parent widget up the DOM tree, or null.

Returns

Widget<any>[]

Source

src/widgets.ts:293


helpUrl

get helpUrl(): string

When provided, adds a "?" icon to the dialog header on the right.

set helpUrl(url): void

Parameters

ParameterType
urlstring

Returns

string

Source

src/widgets.ts:724


inputs

get inputs(): InputBase<any>[]

Returns a list of the dialog's inputs.

Returns

InputBase<any>[]

Source

src/widgets.ts:732


namedInputs

get namedInputs(): Inputs

gets typed inputs with captions as keys.

Returns

Inputs

Source

src/widgets.ts:817


onClose

get onClose(): Observable<any>

Returns

Observable<any>

Source

src/widgets.ts:778


parent

get parent(): null | Widget<any>

Parent widget up the DOM tree, or null.

Returns

null | Widget<any>

Source

src/widgets.ts:290


root

get root(): HTMLElement

Widget's visual root.

Returns

HTMLElement

Source

src/widgets.ts:482


title

get title(): string

Returns the title of a dialog.

set title(t): void

Parameters

ParameterType
tstring

Returns

string

Source

src/widgets.ts:728


type

get type(): string

Returns

string

Source

src/widgets.ts:481

Methods

add()

add(content): Dialog<Inputs>

Adds content to the dialog. using addInput() for inputs is preferred, as it provides better type safety.

Parameters

ParameterTypeDescription
contentHTMLElement | Widget<any> | InputBase<any>

Returns

Dialog<Inputs>

Source

src/widgets.ts:804


addButton()

addButton(text, action, index, tooltip): Dialog<Inputs>

Adds command button with the specified text.

Parameters

ParameterTypeDefault valueDescription
textstringundefined
actionFunctionundefined
indexnumber0
tooltipanynull

Returns

Dialog<Inputs>

Source

src/widgets.ts:846


addContextAction()

addContextAction(text, action): Dialog<Inputs>

Adds context action with the specified text.

Parameters

ParameterTypeDescription
textstring
actionFunction

Returns

Dialog<Inputs>

Source

src/widgets.ts:856


addInput()

addInput<K, V>(caption, input): Dialog<Record<K, V> & Inputs>

Adds named input, which than can be used in combo with namedInputs, to get inputs in type-safe way

Type parameters

Type parameter
K extends string
V extends InputBase<any>

Parameters

ParameterType
captionK
inputV

Returns

Dialog<Record<K, V> & Inputs>

Source

src/widgets.ts:810


addProperty()

private addProperty(propertyName, propertyType, defaultValue, options): any

Registers an property with the specified type, name, and defaultValue.

Parameters

ParameterTypeDefault valueDescription
propertyNamestringundefined
propertyType"string" | "bigint" | "object" | "map" | "file" | "view" | "blob" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe" | "num" | "string_list" | "dataframe_list" | "cell" | "column" | "column_list" | "graphics" | "tablerowfiltercall" | "colfiltercall" | "bitset" | "dynamic" | "viewer" | "list" | "semantic_value" | "func" | "funccall" | "property" | "categorical" | "numerical" | "GridCellRenderArgs" | "element" | "TableView" | "User" | "Menu" | "Project" | "event_data" | "progressindicator" | "Credentials" | "ScriptEnvironment" | "Notebook"undefined
defaultValueanynull
optionsnull | object & IPropertynull

Returns

any

Inherited from

DartWidget . addProperty

See

Registered property gets added to properties. Returns default value, thus allowing to combine registering a property with the initialization

Source

src/widgets.ts:318


apply()

apply(properties): Widget<any>

Parameters

ParameterTypeDescription
propertiesobject

Returns

Widget<any>

Inherited from

DartWidget . apply

Source

src/widgets.ts:257


awaitOnOK()

awaitOnOK<T>(handler): Promise<T>

Sets the OK button handler and returns a promise of the handler callback.

Type parameters

Type parameterValue
Tany

Parameters

ParameterTypeDescription
handler() => Promise<T>

Returns

Promise<T>

Source

src/widgets.ts:756


clear()

clear(): void

Clears the content.

Returns

void

Source

src/widgets.ts:876


close()

close(): void

Closes the dialog.

Returns

void

Source

src/widgets.ts:827


detach()

detach(): void

Gets called when a widget is detached and will no longer be used. Typically used for unsubscribing from events. Be sure to call super.detach() if this method is overridden.

Returns

void

Inherited from

DartWidget . detach

Source

src/widgets.ts:302


getButton()

getButton(text): HTMLButtonElement

Returns command button with the specified text.

Parameters

ParameterTypeDescription
textstring

Returns

HTMLButtonElement

Source

src/widgets.ts:835


getDartProperties()

getDartProperties(): any[]

Returns

any[]

Inherited from

DartWidget . getDartProperties

Source

src/widgets.ts:278


getFunctions()

getFunctions(): Func[]

Functions that are applicable to this particular widget. Used in the UI to display context actions, and for the AI integrations.

Returns

Func[]

Inherited from

DartWidget . getFunctions

Source

src/widgets.ts:484


getProperties()

getProperties(): Property[]

Returns all properties of this widget.

Returns

Property[]

Inherited from

DartWidget . getProperties

Source

src/widgets.ts:483


history()

history(getInput, applyInput): void

Initializes the 'history' feature.

Parameters

ParameterTypeDescription
getInput() => anycollects the input from UI into JSON-serializable object
applyInput(x) => voidrefreshes the UI according to input

Returns

void

Source

src/widgets.ts:865


initDefaultHistory()

initDefaultHistory(): Dialog<Inputs>

Initializes default history.

Returns

Dialog<Inputs>

Source

src/widgets.ts:870


initFromLocalStorage()

initFromLocalStorage(): void

Initializes the dialog properties from local storage.

Returns

void

Source

src/widgets.ts:886


input()

input(caption): InputBase<any>

Returns an input with the specified caption, or throws an exception.

Parameters

ParameterType
captionstring

Returns

InputBase<any>

Source

src/widgets.ts:735


onCancel()

onCancel(handler): Dialog<Inputs>

Sets the CANCEL button handler

Parameters

ParameterTypeDescription
handlerFunction

Returns

Dialog<Inputs>

Source

src/widgets.ts:772


onFrameAttached()

onFrameAttached(dataFrame): void

Parameters

ParameterType
dataFrameDataFrame

Returns

void

Inherited from

DartWidget . onFrameAttached

Source

src/widgets.ts:284


onOK()

onOK(handler, options?): Dialog<Inputs>

Sets the OK button handler, and shows the OK button

Parameters

ParameterTypeDescription
handlerFunction
options?object
options.closeOnEnter?boolean-

Returns

Dialog<Inputs>

Source

src/widgets.ts:747


onPropertyChanged()

onPropertyChanged(property): void

Gets called when viewer's property is changed.

Parameters

ParameterTypeDescription
propertynull | Propertyor null, if multiple properties were changed.

Returns

void

Inherited from

DartWidget . onPropertyChanged

Source

src/widgets.ts:276


show()

show(options?): Dialog<Inputs>

Parameters

ParameterTypeDescription
options?object
options.backgroundColor?string-
options.center?boolean-
options.centerAt?Element-
options.fullScreen?boolean-
options.height?number-
options.modal?boolean-
options.resizable?boolean-
options.showNextTo?HTMLElement-
options.width?number-
options.x?number-
options.y?number-

Returns

Dialog<Inputs>

Source

src/widgets.ts:789


showModal()

showModal(fullScreen): Dialog<Inputs>

Parameters

ParameterTypeDescription
fullScreenboolean

Returns

Dialog<Inputs>

Source

src/widgets.ts:796


sourceRowsChanged()

sourceRowsChanged(): void

Returns

void

Inherited from

DartWidget . sourceRowsChanged

Source

src/widgets.ts:282


sub()

sub(subscription): void

Registers a subscription to an external event.

Parameters

ParameterTypeDescription
subscriptionSubscription

Returns

void

Inherited from

DartWidget . sub

Source

src/widgets.ts:250


toDart()

toDart(): any

Returns

any

Inherited from

DartWidget . toDart

Source

src/widgets.ts:242


create()

static create(options?): Dialog<object>

Creates a new dialog with the specified options.

Parameters

ParameterType
options?string | object

Returns

Dialog<object>

Source

src/widgets.ts:716


find()

static find(root): null | Widget<any>

Finds existing widget from its visual root.

Parameters

ParameterType
rootElement

Returns

null | Widget<any>

Inherited from

DartWidget . find

Source

src/widgets.ts:238


fromRoot()

static fromRoot(root): Widget<any>

Creates a new widget from the root element.

Parameters

ParameterType
rootHTMLElement

Returns

Widget<any>

Inherited from

DartWidget . fromRoot

Source

src/widgets.ts:341


getAll()

static getAll(): Widget<any>[]

Returns all currently active widgets.

Returns

Widget<any>[]

Inherited from

DartWidget . getAll

Source

src/widgets.ts:233


getOpenDialogs()

static getOpenDialogs(): Dialog<object>[]

Returns currently open dialogs.

Returns

Dialog<object>[]

Source

src/widgets.ts:881