how to give hyperlink on right click ?

On spreadsheet ,if I user selects column and right click on it few options will appear.I want to achiever below things on that right click menu.

  1. I have 5 options on right click out of those 5 i want to show only 3 options to few columns , and all 5 options will be visible to few columns. how to add condition for that?
  2. How to give hyperlink to right click menu?

Hey @priyatama,

1\. You can get the current position of the context menu before it gets shown inside of the onBeforeShow event with the help of a locate method, which will point us directly to the clicked column/row.

Depending on your conditions, you can hide/disable certain items in the context menu. For instance, in this example I’m only displaying all of the options in the first 2 columns: https://snippet.webix.com/308ipwzi.

2\. Normally, the easiest way would be to set a template containing a with our value wrapped inside the link. But in this case it won’t work, since the context menu items are links themselves (using <a> HTML tag), meaning you’ll have to work around it.

The recommended way would be to use an onItemClick event and redirect the user via the window.open() method: https://snippet.webix.com/qhoease6.

Hey @Dzmitry - Thanks for above code
This is my code for context menu.
on:{

						onContextMenuConfig:function(ev){
							if (ev.area == "column" || ev.area == "row") return false;
							if (ev.area == "data")
								ev.data = [
									{ id:"com-1", group:"myContext", value:"Edit Standard Skill" },
									{ id:"com-2", group:"myContext", value:"Non-Standard Skill" },
									{ id:"com-3", group:"myContext", value:"Command 3" }
								];
								
								
						},

I want to show “Non-Standard Skill” only of column value is “calculateArea”.

@Dzmitry - also on right click of “Non-standard Skill” I want value of that Cell.

To give you a brief idea, you can sort of combine everything I’ve talked about before, as in: you can get the position of the cell you’ve clicked on to summon the context menu (we need that to get the cell value as well) in the onBeforeShow event, which in turn allows you to know which column you’re in.

To actually attach a custom action to your menu items, one of the ways you could go about it is to use an onItemClick event attached to the menu itself.

Here is just a rough example: https://snippet.webix.com/se5f0x27.

Please note that it doesn’t seem possible to get the cell value without using global variables, as the needed cell positions are stored in the onBeforeShow event, and the actual action we need to perform is attached to a completely different event.

hey @Dzmitry - it works beautifully, thanks