I have a web app built with the arcgis js 4 api that uses the featuretable widget. I would like to enable some of the stock menu items on the feature table such as zoom to selected features. This works fine until I try to add additional custom items to the menu. Then the options related to selected features in the table (zoom to selection, show selection, clear selection, etc.) are no longer available. Does anyone know how to add a custom menu item and keep this functionality?
// Create the feature table
const featureTable = new FeatureTable({
view: view,
layer: featureLayer,
visibleElements: {
menu: true,
// Autocast to VisibleElements
menuItems: {
clearSelection: true,
refreshData: true,
toggleColumns: true,
selectedRecordsShowAllToggle: true,
selectedRecordsShowSelectedToggle: true,
zoomToSelection: true
}
},
container: "tableDiv"
});
//Adds custom menu options to featuretable
featureTable.when().then(() => {
const buttonMenuItem1 = new ButtonMenuItem ({
label: "Download Table",
clickFunction: function (event) {
setupCSV();
}
});
const buttonMenu = new ButtonMenu ({
iconClass: "esri-icon-handle-horizontal",
items: []
});
featureTable.menu.items.forEach(element => {
console.log(element.label);
buttonMenu.items.push(element);
});
buttonMenu.items.push(buttonMenuItem1);
featureTable.menuConfig = buttonMenu;
});