ButtonMenuItem

AMD: require(["esri/widgets/FeatureTable/Grid/support/ButtonMenuItem"], (ButtonMenuItem) => { /* code goes here */ });
ESM: import ButtonMenuItem from "@arcgis/core/widgets/FeatureTable/Grid/support/ButtonMenuItem.js";
Class: esri/widgets/FeatureTable/Grid/support/ButtonMenuItem
Inheritance: ButtonMenuItem Accessor
Since: ArcGIS Maps SDK 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

ButtonMenuItem

Constructor
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.

ButtonMenuItem
ButtonMenuItemClickFunction

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

ButtonMenuItem
String

The name of the class.

Accessor
String

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

ButtonMenuItem
ButtonMenuItem[]

An array of individual menu items.

ButtonMenuItem
String

The label of the menu item.

ButtonMenuItem
Boolean

Indicates if the menu content is visible.

ButtonMenuItem
Boolean

Indicates whether the menu item is selected.

ButtonMenuItem
Boolean

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

ButtonMenuItem

Property Details

autoCloseMenu

Property
autoCloseMenu Boolean

Indicates whether to automatically close the menu's item.

Default Value:false

clickFunction

Property
clickFunction ButtonMenuItemClickFunction

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

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor

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

iconClass

Property
iconClass String
Deprecated since 4.27. Use icon instead.

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

featuretable widget menu items

items

Property
items ButtonMenuItem[]autocast

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

Property
label String

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

open

Property
open Boolean

Indicates if the menu content is visible.

Default Value:false

selected

Property
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

Property
selectionEnabled Boolean

Indicates whether a toggled state should be applied to individual menu items. An example of this can be seen with the individual 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.

Accessor
Boolean

Returns true if a named group of handles exist.

Accessor

Removes a group of handles owned by the object.

Accessor

Method Details

addHandles

Inherited
Method
addHandles(handleOrHandles, groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, addHandles added at 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 }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
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

Inherited
Method
hasHandles(groupKey){Boolean}
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, hasHandles added at 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

Inherited
Method
removeHandles(groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, removeHandles added at 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

Type Definition
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.