ButtonMenuItem

AMD: require(["esri/widgets/FeatureTable/Grid/support/ButtonMenuItem"], (ButtonMenuItem) => { /* code goes here */ });
ESM: import ButtonMenuItem from "@arcgis/core/widgets/FeatureTable/Grid/support/ButtonMenuItem";
Class: esri/widgets/FeatureTable/Grid/support/ButtonMenuItem
Inheritance: ButtonMenuItem Accessor
Since: ArcGIS API for JavaScript 4.16

The ButtonMenuItem class provides the underlying menu functionality to create and customize new menu items within the FeatureTable widget's ButtonMenu.

Known Limitations Dark themed CSS is currently not supported.

The following image displays two custom ButtonMenuItems added to the FeatureTable widget's ButtonMenu.

default and custom feature table menus

See also

Constructors

new ButtonMenuItem(properties)
Parameter
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Example
// Typical usage for ButtonMenuItem
const buttonMenuItem1 = new ButtonMenuItem ({
  label: "custom menu item label",
  iconClass: "Icon font name, if applicable",
  clickFunction: function () {
    // Add custom function to perform on menu item button click
  }
});

const buttonMenuItem2 = new ButtonMenuItem ({
  label: "Second custom menu item label",
  iconClass: "Second icon font name, if applicable",
  clickFunction: function (event) {
    // Add second custom function to perform on menu item button click
  }
});

// Apply the button menu items above to the button menu
const buttonMenu = new ButtonMenu ({
  iconClass: "esri-icon-left",
  items: [buttonMenuItem1, buttonMenuItem2]
});

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
Boolean

Indicates whether to automatically close the menu's item.

more details
ButtonMenuItem
ButtonMenuItemClickFunction

A function that executes on the ButtonMenuItem's click event.

more details
ButtonMenuItem
String

The name of the class.

more details
Accessor
String

Adds a CSS class to the menu button's DOM node.

more details
ButtonMenuItem
ButtonMenuItem[]

An array of individual menu items.

more details
ButtonMenuItem
String

The label of the menu item.

more details
ButtonMenuItem
Boolean

Indicates if the menu content is visible.

more details
ButtonMenuItem
Boolean

Indicates whether the menu item is selected.

more details
ButtonMenuItem
Boolean

Indicates whether a toggled state should be applied to individual menu items.

more details
ButtonMenuItem

Property Details

autoCloseMenu Boolean

Indicates whether to automatically close the menu's item.

Default Value:false

A function that executes on the ButtonMenuItem's click event. If applicable, it provides the developer with access to the input ButtonMenuItem and its properties.

declaredClass Stringreadonly inherited

The name of the class. The declared class name is formatted as esri.folder.className.

iconClass String

Adds a CSS class to the menu button's DOM node.

featuretable widget menu items

See also

An array of individual menu items.

The following image shows a custom menu item with two nested menu items within it.

Custom nested menu items

Example
// Button menu items are autocastable in the ButtonMenu
items: [{
  label: "Custom menu item",
  iconClass: "esri-icon-right",
  items: [{
    label: "Nested menu item 1",
    clickFunction: function(event) {
      // click function for first nested menu item
    },
  }, {
    label: "Nested menu item 2",
    clickFunction: function(event) {
      // click function for second nested menu item
    },
  }],
  clickFunction: function(event) {
  // click function on parent menu item
  }
}]
label String

The label of the menu item. This can be used in conjunction with the iconClass property.

open Boolean

Indicates if the menu content is visible.

Default Value:false
selected Boolean

Indicates whether the menu item is selected. This is useful in use-cases when needing to apply a toggled state to individual menu items. An example of this can be seen in the default menu's Show/hide columns button. Use this in combination when selectionEnabled is true.

Default Value:false
See also
selectionEnabled Boolean

Indicates whether a toggled state should be applied to individual menu items. An example of this can be seen with the invididual items nested under the default menu's Show/hide columns. Use this in combination with the selected property.

Show/hide columns

Default Value:false
See also

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

more details
Accessor
Boolean

Returns true if a named group of handles exist.

more details
Accessor

Removes a group of handles owned by the object.

more details
Accessor

Method Details

addHandles(handleOrHandles, groupKey)inherited
Since: ArcGIS API for JavaScript 4.25

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

// Handle gets removed when the object is destroyed.
this.addHandles(handle);
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

hasHandles(groupKey){Boolean}inherited
Since: ArcGIS API for JavaScript 4.25

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}
removeHandles(groupKey)inherited
Since: ArcGIS API for JavaScript 4.25

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

Type Definitions

ButtonMenuItemClickFunction(event)

Function definition for the clickFunction property.

Parameters
event Object

An object containing the clicked ButtonMenuItem.

Specification

A reference to the clicked ButtonMenuItem.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.