Posted 10 December 2018, 4:40 am EST
Hi,
I am trying to implement a custom menu like described here https://www.grapecity.com/en/demos/spread/JS/TutorialSample/#/demos/extendContextMenu
I am having trouble detecting the selected menu item from the ‘command’ function
I am using Angular 5, and so far I have implemented the following code:
private customMenuView() {
this._spread.contextMenu.menuData =[];
const menuItems:Array<CustomField> = this._appModelService.myMenuItems.filter(item => item.columnAssigned === null);
for (let i = 0; i < menuItems.length; i++) {
console.log(menuItems[0]);
let itemMenuField:GC.Spread.Sheets.ContextMenu.IMenuItemData = {
text: menuItems[i].name,
name: menuItems[i].name,
command: this.showLoginDialog;
workArea: 'colHeader'// viewport
};
this._spread.contextMenu.menuData.push(itemMenuField);
}
}
private showLoginDialog(args:any)
{
console.log(args);
}
When showLoginDialog is called, I d like to know which item of the menu has been activated, so that depending on that an action is performed.
Any idea how that can be achieved?
Thanks.