I am very confused, because I followed official samples and codes, but none worked for me.
I am mostly a new developer that's learning both JS and Experience Builder.
I tried codes from both of these related questions:
How to display feature table
How to customize the feature table
I also researched many samples and tried the codes, like:
Widgets Tablelist
Widgets FeatureTable Editing
I cannot add a custom button anywhere in the feature table through ButtonMenu, ButtonMenuItem.
I am very confused because it is all official documentation, but it doesn't work for me in either
JS files that I manually create or through custom widget in Experience Builder. Neither works for me.
featureTable.visibleElements = {
header: true,
menu: true,
menuItems: {
clearSelection: true,
refreshData: true,
toggleColumns: true,
selectedRecordsShowAllToggle: true,
zoomToSelection: true
},
selectionColumn: true,
columnMenus: true
}
featureTable.when().then(() => {
const newMenuItem = {
label: "Do something",
iconClass: "Icon font name, if applicable",
visible: true,
clickFunction: (event) => {
console.log("Clicked!");
}
};
featureTable.menu.items.push(newMenuItem);
});
// 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: "esri-icon-minimize",
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-minimize",
items: [buttonMenuItem1, buttonMenuItem2]
});
None of the above worked for me. I cannot determine any issues.
Is it possible all of this is because of specific Feature Layer limitations? I have no knowledge of how feature layers are made from administrators. Thank you any feedback is welcome.