Context Menu - 2 quesitons

I’m trying to load submenu into context menu via XML.

Questions:

  1. what is the sample XML structure with submenu ?
    I provided an example below, but submenu does not work

  2. How to show separator?

<data>
	<item id="6" value="Grid Operations">
		<submenu>
			<item id="1" value="Add"/>
			<item id="2" value="Edit"/>
			<item id="3" value="Delete"/>
			<item id="4" value="Separator"/>
			<item id="5" value="View Record"/>
		</submenu>
	</item>
</data>

Thanks,
Vasiliy

Hi,

Submenus can be initialized beforehand and then their ID can be included in menu/contextmenu data:

http://webix.com/snippet/1ff7a3f8

While above is valid, you still can use a single xml structure

http://webix.com/snippet/cb5412c6

<ui>
  <menu layout="y" width="150"  autoheight="true">
    <data>
      <li id="1">
         <value>One</value>
         <submenu stack="1">
           <li>sub 1</li>
           <li>sub 2</li>
         </submenu>
      </li>
      <li id="2">Two</li>
      <li id="3">Three</li>
    </data>
  </menu>
</ui>

Thank you.

Just curious, why:

  1. popup menu needs menu item nodes as “li”, and context menu as “item”?

  2. stack=“1” is always mandatory?
    Without stack=“1” the menu does not work at all.

Also, how can I set icons on submenu items?
Tried this configuration w/o luck: http://webix.com/snippet/418485cc

Issues:

1.  Icons repeat on 1-st level

2.  Next level does not have icons at all, no matter what I tried

As to the icons - template for submenu items is set in a separate configuration object http://webix.com/snippet/cc73faef

In JS initialization it looks like this: http://docs.webix.com/samples/03_menu/12_submenu_config.html

stack=“1” just means that the child tags should be parsed as JS array.

template for submenu items is set in a separate configuration object

Does it work the same for Context menu?
I tried and could not make it working for Context menu.

It’s all the same for the context menu, please check the snippet http://webix.com/snippet/41692acb.