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
| Parameter | Type |
|---|---|
label | string | Element |
options? | DropDownOptions |
Returns
Overrides
Source
src/widgets/specialized.ts:108
Properties
| Property | Modifier | Type | Default value | Description | Inherited from |
|---|---|---|---|---|---|
_contentContainer? | private | HTMLElement | undefined | - | - |
_currentMenu | private | null | Menu | undefined | - | - |
_functions | protected | Func[] | [] | - | Widget._functions |
_isExpanded | private | boolean | undefined | - | - |
_menuCloseSub | private | null | Subscription | undefined | - | - |
_options? | private | DropDownOptions | undefined | - | - |
_properties | protected | Property[] | [] | - | Widget._properties |
_root | protected | HTMLElement | undefined | - | Widget._root |
dart | public | any | undefined | - | Widget.dart |
factory | public | null | Func | null | Constructor function. No parameters, returns [Widget]. | Widget.factory |
isDetached | public | boolean | false | - | Widget.isDetached |
props | public | any | undefined | - | Widget.props |
subs | public | Subscription[] | undefined | - | Widget.subs |
temp | public | any | undefined | Contains auxiliary information | Widget.temp |
Accessors
children
getchildren():Widget<any>[]
Parent widget up the DOM tree, or null.
Returns
Widget<any>[]
Source
isExpanded
getisExpanded():boolean
Returns
boolean
Source
src/widgets/specialized.ts:130
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.
setroot(r):void
Parameters
| Parameter | Type |
|---|---|
r | HTMLElement |
Returns
HTMLElement
Source
type
gettype():string
Returns
string
Source
src/widgets/specialized.ts:106
Methods
_initCustomDropDown()
private_initCustomDropDown(createElement):void
Parameters
| Parameter | Type |
|---|---|
createElement | () => HTMLElement |
Returns
void
Source
src/widgets/specialized.ts:212
_initListDropDown()
private_initListDropDown(items,listOptions?):void
Parameters
| Parameter | Type |
|---|---|
items | string[] |
listOptions? | DropDownListOptions |
Returns
void
Source
src/widgets/specialized.ts:201
_initMenuDropDown()
private_initMenuDropDown(items):void
Parameters
| Parameter | Type |
|---|---|
items | DropDownMenuItems | DropDownMenuBuilder |
Returns
void
Source
src/widgets/specialized.ts:160
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
collapse()
collapse(
hideMenu):void
Parameters
| Parameter | Type | Default value |
|---|---|---|
hideMenu | boolean | true |
Returns
void
Source
src/widgets/specialized.ts:143
detach()
detach():
void
Removes the widget and cleans up resources
Returns
void
Overrides
Source
src/widgets/specialized.ts:118
expand()
expand():
void
Returns
void
Source
src/widgets/specialized.ts:134
getDartProperties()
getDartProperties():
any[]
Returns
any[]
Inherited from
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
onFrameAttached()
onFrameAttached(
dataFrame):void
Parameters
| Parameter | Type |
|---|---|
dataFrame | DataFrame |
Returns
void
Inherited from
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. |
Returns
void
Inherited from
Source
removeMenuSubscription()
removeMenuSubscription():
void
Returns
void
Source
src/widgets/specialized.ts:125
sourceRowsChanged()
sourceRowsChanged():
void
Returns
void
Inherited from
Source
sub()
sub(
subscription):void
Registers a subscription to an external event.
Parameters
| Parameter | Type | Description |
|---|---|---|
subscription | Subscription |
Returns
void
Inherited from
Source
toDart()
toDart():
any
Returns
any
Inherited from
Source
custom()
staticcustom(label,createElement,options?):DropDown
Creates a dropdown with custom content.
Parameters
| Parameter | Type | Description |
|---|---|---|
label | string | Element | Text or element to display as the dropdown trigger |
createElement | () => HTMLElement | Function that creates the dropdown content element |
options? | DropDownOptions | Optional dropdown options |
Returns
Source
src/widgets/specialized.ts:306
find()
staticfind(root):null|Widget<any>
Finds existing widget from its visual root.
Parameters
| Parameter | Type |
|---|---|
root | Element |
Returns
null | Widget<any>
Inherited from
Source
fromRoot()
staticfromRoot(root):Widget<any>
Creates a new widget from the root element.
Parameters
| Parameter | Type |
|---|---|
root | HTMLElement |
Returns
Widget<any>
Inherited from
Source
getAll()
staticgetAll():Widget<any>[]
Returns all currently active widgets.
Returns
Widget<any>[]
Inherited from
Source
list()
staticlist(label,items,listOptions?,options?):DropDown
Creates a dropdown with a list of selectable items.
Parameters
| Parameter | Type | Description |
|---|---|---|
label | string | Element | Text or element to display as the dropdown trigger |
items | string[] | Array of string items to display |
listOptions? | DropDownListOptions | Options including onItemClick callback |
options? | DropDownOptions | Optional dropdown options |
Returns
Source
src/widgets/specialized.ts:295
menu()
staticmenu(label,items,options?):DropDown
Creates a dropdown with menu items. This is the recommended way to create dropdowns.
Parameters
| Parameter | Type | Description |
|---|---|---|
label | string | Element | Text or element to display as the dropdown trigger |
items | DropDownMenuItems | DropDownMenuBuilder | Menu items object, or a builder function for full Menu access |
options? | DropDownOptions | Optional dropdown options |
Returns
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'));
});