I have followed the instructions from https://github.com/SharePoint/sp-dev-docs/blob/main/docs/spfx/extensions/get-started/building-simple-cmdset-with-dialog-api.md . It results in code similar to:
@override
public onExecute(event: IListViewCommandSetExecuteEventParameters): void {
switch (event.itemId) {
case 'COMMAND_1':
Dialog.alert(`Clicked ${strings.Command1}`);
break;
case 'COMMAND_2':
Dialog.prompt(`Clicked ${strings.Command2}. Enter something to alert:`).then((value: string) => {
Dialog.alert(value);
});
break;
default:
throw new Error('Unknown command');
}
}
I would like to know how to associate a menu with Command_2 for example. Instead of an action being called when the user clicks the button I would rather a menu be displayed and the onExecute being called when a menu selection occurs.