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 parameter | Value |
|---|---|
Inputs extends Record<string, InputBase<any>> | object |
Constructors
new Dialog()
new Dialog<
Inputs>(dart):Dialog<Inputs>
Parameters
| Parameter | Type |
|---|---|
dart | any |
Returns
Dialog<Inputs>
Overrides
Source
Properties
| Property | Modifier | Type | Default value | Description | Inherited from |
|---|---|---|---|---|---|
_functions | protected | Func[] | [] | - | DartWidget._functions |
_properties | protected | Property[] | [] | - | DartWidget._properties |
_root | protected | HTMLElement | undefined | - | DartWidget._root |
dart | public | any | undefined | - | DartWidget.dart |
factory | public | null | Func | null | Constructor function. No parameters, returns [Widget]. | DartWidget.factory |
isDetached | public | boolean | false | - | DartWidget.isDetached |
props | public | any | undefined | - | DartWidget.props |
subs | public | Subscription[] | undefined | - | DartWidget.subs |
temp | public | any | undefined | Contains auxiliary information | DartWidget.temp |
Accessors
children
getchildren():Widget<any>[]
Parent widget up the DOM tree, or null.
Returns
Widget<any>[]
Source
helpUrl
gethelpUrl():string
When provided, adds a "?" icon to the dialog header on the right.
sethelpUrl(url):void
Parameters
| Parameter | Type |
|---|---|
url | string |
Returns
string
Source
inputs
getinputs():InputBase<any>[]
Returns a list of the dialog's inputs.
Returns
InputBase<any>[]
Source
namedInputs
getnamedInputs():Inputs
gets typed inputs with captions as keys.
Returns
Inputs
Source
onClose
getonClose():Observable<any>
Returns
Observable<any>
Source
parent
getparent():null|Widget<any>
Parent widget up the DOM tree, or null.
Returns
null | Widget<any>
Source
root
getroot():HTMLElement
Widget's visual root.
Returns
HTMLElement
Source
title
gettitle():string
Returns the title of a dialog.
settitle(t):void
Parameters
| Parameter | Type |
|---|---|
t | string |
Returns
string
Source
type
gettype():string
Returns
string
Source
Methods
add()
add(
content):Dialog<Inputs>
Adds content to the dialog. using addInput() for inputs is preferred, as it provides better type safety.
Parameters
| Parameter | Type | Description |
|---|---|---|
content | HTMLElement | Widget<any> | InputBase<any> |
Returns
Dialog<Inputs>
Source
addButton()
addButton(
text,action,index,tooltip):Dialog<Inputs>
Adds command button with the specified text.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
text | string | undefined | |
action | Function | undefined | |
index | number | 0 | |
tooltip | any | null |
Returns
Dialog<Inputs>
Source
addContextAction()
addContextAction(
text,action):Dialog<Inputs>
Adds context action with the specified text.
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | |
action | Function |
Returns
Dialog<Inputs>
Source
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
| Parameter | Type |
|---|---|
caption | K |
input | V |
Returns
Dialog<Record<K, V> & Inputs>
Source
addProperty()
privateaddProperty(propertyName,propertyType,defaultValue,options):any
Registers an property with the specified type, name, and defaultValue.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
propertyName | string | undefined | |
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 | |
defaultValue | any | null | |
options | null | object & IProperty | null |
Returns
any
Inherited from
See
Registered property gets added to properties. Returns default value, thus allowing to combine registering a property with the initialization
Source
apply()
apply(
properties):Widget<any>
Parameters
| Parameter | Type | Description |
|---|---|---|
properties | object |
Returns
Widget<any>
Inherited from
Source
awaitOnOK()
awaitOnOK<
T>(handler):Promise<T>
Sets the OK button handler and returns a promise of the handler callback.
Type parameters
| Type parameter | Value |
|---|---|
T | any |
Parameters
| Parameter | Type | Description |
|---|---|---|
handler | () => Promise<T> |
Returns
Promise<T>
Source
clear()
clear():
void
Clears the content.
Returns
void
Source
close()
close():
void
Closes the dialog.
Returns
void
Source
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
Source
getButton()
getButton(
text):HTMLButtonElement
Returns command button with the specified text.
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string |
Returns
HTMLButtonElement
Source
getDartProperties()
getDartProperties():
any[]
Returns
any[]
Inherited from
DartWidget . getDartProperties
Source
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
Source
getProperties()
getProperties():
Property[]
Returns all properties of this widget.
Returns
Property[]
Inherited from
Source
history()
history(
getInput,applyInput):void
Initializes the 'history' feature.
Parameters
| Parameter | Type | Description |
|---|---|---|
getInput | () => any | collects the input from UI into JSON-serializable object |
applyInput | (x) => void | refreshes the UI according to input |
Returns
void
Source
initDefaultHistory()
initDefaultHistory():
Dialog<Inputs>
Initializes default history.
Returns
Dialog<Inputs>
Source
initFromLocalStorage()
initFromLocalStorage():
void
Initializes the dialog properties from local storage.
Returns
void
Source
input()
input(
caption):InputBase<any>
Returns an input with the specified caption, or throws an exception.
Parameters
| Parameter | Type |
|---|---|
caption | string |
Returns
InputBase<any>
Source
onCancel()
onCancel(
handler):Dialog<Inputs>
Sets the CANCEL button handler
Parameters
| Parameter | Type | Description |
|---|---|---|
handler | Function |
Returns
Dialog<Inputs>
Source
onFrameAttached()
onFrameAttached(
dataFrame):void
Parameters
| Parameter | Type |
|---|---|
dataFrame | DataFrame |
Returns
void
Inherited from
Source
onOK()
onOK(
handler,options?):Dialog<Inputs>
Sets the OK button handler, and shows the OK button
Parameters
| Parameter | Type | Description |
|---|---|---|
handler | Function | |
options? | object | |
options.closeOnEnter? | boolean | - |
Returns
Dialog<Inputs>
Source
onPropertyChanged()
onPropertyChanged(
property):void
Gets called when viewer's property is changed.
Parameters
| Parameter | Type | Description |
|---|---|---|
property | null | Property | or null, if multiple properties were changed. |