Skip to main content

DropDown

Base class for controls that have a visual root and a set of properties.

Extends

Constructors

new DropDown()

new DropDown(label, options?): DropDown

Parameters

ParameterType
labelstring | Element
options?DropDownOptions

Returns

DropDown

Overrides

Widget . constructor

Source

src/widgets/specialized.ts:108

Properties

PropertyModifierTypeDefault valueDescriptionInherited from
_contentContainer?privateHTMLElementundefined--
_currentMenuprivatenull | Menuundefined--
_functionsprotectedFunc[][]-Widget._functions
_isExpandedprivatebooleanundefined--
_menuCloseSubprivatenull | Subscriptionundefined--
_options?privateDropDownOptionsundefined--
_propertiesprotectedProperty[][]-Widget._properties
_rootprotectedHTMLElementundefined-Widget._root
dartpublicanyundefined-Widget.dart
factorypublicnull | FuncnullConstructor function. No parameters, returns [Widget].Widget.factory
isDetachedpublicbooleanfalse-Widget.isDetached
propspublicanyundefined-Widget.props
subspublicSubscription[]undefined-Widget.subs
temppublicanyundefinedContains auxiliary informationWidget.temp

Accessors

children

get children(): Widget<any>[]

Parent widget up the DOM tree, or null.

Returns

Widget<any>[]

Source

src/widgets/base.ts:284


isExpanded

get isExpanded(): boolean

Returns

boolean

Source

src/widgets/specialized.ts:130


parent

get parent(): null | Widget<any>

Parent widget up the DOM tree, or null.

Returns

null | Widget<any>

Source

src/widgets/base.ts:281


root

get root(): HTMLElement

Widget's visual root.

set root(r): void

Parameters

ParameterType
rHTMLElement

Returns

HTMLElement

Source

src/widgets/base.ts:288


type

get type(): string

Returns

string

Source

src/widgets/specialized.ts:106

Methods

_initCustomDropDown()

private _initCustomDropDown(createElement): void

Parameters

ParameterType
createElement() => HTMLElement

Returns

void

Source

src/widgets/specialized.ts:212


_initListDropDown()

private _initListDropDown(items, listOptions?): void

Parameters

ParameterType
itemsstring[]
listOptions?DropDownListOptions

Returns

void

Source

src/widgets/specialized.ts:201


_initMenuDropDown()

private _initMenuDropDown(items): void

Parameters

ParameterType
itemsDropDownMenuItems | DropDownMenuBuilder

Returns

void

Source

src/widgets/specialized.ts:160


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

Widget . addProperty

See

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

Source

src/widgets/base.ts:309


apply()

apply(properties): Widget<any>

Parameters

ParameterTypeDescription
propertiesobject

Returns

Widget<any>

Inherited from

Widget . apply

Source

src/widgets/base.ts:248


collapse()

collapse(hideMenu): void

Parameters

ParameterTypeDefault value
hideMenubooleantrue

Returns

void

Source

src/widgets/specialized.ts:143


detach()

detach(): void

Removes the widget and cleans up resources

Returns

void

Overrides

Widget . detach

Source

src/widgets/specialized.ts:118


expand()

expand(): void

Returns

void

Source

src/widgets/specialized.ts:134


getDartProperties()

getDartProperties(): any[]

Returns

any[]

Inherited from

Widget . getDartProperties

Source

src/widgets/base.ts:269


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

Widget . getFunctions

Source

src/widgets/base.ts:263


getProperties()

getProperties(): Property[]

Returns all properties of this widget.

Returns

Property[]

Inherited from

Widget . getProperties

Source

src/widgets/base.ts:259


onFrameAttached()

onFrameAttached(dataFrame): void

Parameters

ParameterType
dataFrameDataFrame

Returns

void

Inherited from

Widget . onFrameAttached

Source

src/widgets/base.ts:275


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

Widget . onPropertyChanged

Source

src/widgets/base.ts:267


removeMenuSubscription()

removeMenuSubscription(): void

Returns

void

Source

src/widgets/specialized.ts:125


sourceRowsChanged()

sourceRowsChanged(): void

Returns

void

Inherited from

Widget . sourceRowsChanged

Source

src/widgets/base.ts:273


sub()

sub(subscription): void

Registers a subscription to an external event.

Parameters

ParameterTypeDescription
subscriptionSubscription

Returns

void

Inherited from

Widget . sub

Source

src/widgets/base.ts:241


toDart()

toDart(): any

Returns

any

Inherited from

Widget . toDart

Source

src/widgets/base.ts:233


custom()

static custom(label, createElement, options?): DropDown

Creates a dropdown with custom content.

Parameters

ParameterTypeDescription
labelstring | ElementText or element to display as the dropdown trigger
createElement() => HTMLElementFunction that creates the dropdown content element
options?DropDownOptionsOptional dropdown options

Returns

DropDown

Source

src/widgets/specialized.ts:306


find()

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

Finds existing widget from its visual root.

Parameters

ParameterType
rootElement

Returns

null | Widget<any>

Inherited from

Widget . find

Source

src/widgets/base.ts:229


fromRoot()

static fromRoot(root): Widget<any>

Creates a new widget from the root element.

Parameters

ParameterType
rootHTMLElement

Returns

Widget<any>

Inherited from

Widget . fromRoot

Source

src/widgets/base.ts:332


getAll()

static getAll(): Widget<any>[]

Returns all currently active widgets.

Returns

Widget<any>[]

Inherited from

Widget . getAll

Source

src/widgets/base.ts:224


list()

static list(label, items, listOptions?, options?): DropDown

Creates a dropdown with a list of selectable items.

Parameters

ParameterTypeDescription
labelstring | ElementText or element to display as the dropdown trigger
itemsstring[]Array of string items to display
listOptions?DropDownListOptionsOptions including onItemClick callback
options?DropDownOptionsOptional dropdown options

Returns

DropDown

Source

src/widgets/specialized.ts:295


static menu(label, items, options?): DropDown

Creates a dropdown with menu items. This is the recommended way to create dropdowns.

Parameters

ParameterTypeDescription
labelstring | ElementText or element to display as the dropdown trigger
itemsDropDownMenuItems | DropDownMenuBuilderMenu items object, or a builder function for full Menu access
options?DropDownOptionsOptional dropdown options

Returns

DropDown

Example

// Simple object syntax
DropDown.menu('Actions', {
'Add': () => grok.shell.info('add'),
'Edit': () => grok.shell.info('edit'),
});

// Builder function for separators, headers, etc.
DropDown.menu('Actions', (menu) => {
menu.item('Add', () => grok.shell.info('add'));
menu.separator();
menu.item('Delete', () => grok.shell.info('delete'));
});

Source

src/widgets/specialized.ts:283