Context Menu vs. Menu - configuration via initialization data

Menu allows to pass configuration in initialization data.
Example:

<menu width="350" autoheight="true">
...

Can I define similar way the settings for Context Menu?

<contextmenu width="350" autoheight="true">
...

Yes, sure. Autoheight=“true” with contextmenu is optional as it’s its default setting.

Here is an example of context menu, with init via XML.
Where in XML should I add a node with settings?

http://webix.com/snippet/3bba9fc1

I see that you initialize contextmenu within JS configuration, so sizes and other properties are defined there as well:

this._context_menu = webix.ui({ 
	view:"contextmenu", 
	width:420,
        ...

Instead of JS I’d like to initialize via XML, together with data.
Is it posiible?

Autoheight and width are easily applied to a contextmenu initialized via XML. There’s a sample http://webix.com/snippet/41692acb

Thank you.

Tried to set Width of context menu via Config section. No luck.
What am I doing wrong?

http://webix.com/snippet/73e95fbc

Context menu:

<data>
    <item id="2" value="Edit"/>
    <item id="3" value="Delete"/>
    <item id="12" value="New Control">
        <submenu stack="1">
            <config width="350"/>
            <item id="1500" value="Accordion container"/>
            <item id="1600" value="Carousel container"/>
        </submenu>
    </item>
</data>

Hello,

Config and submenu objects are both children of an item that starts this submenu.

<data>
    <item id="2" value="Edit"/>
    <item id="3" value="Delete"/>
    <item id="12" value="New Control">
        <config width="25"/>  /*250 indeed*/
        <submenu stack="1">
            <item id="1500" value="Accordion container"/>
            <item id="1600" value="Carousel container"/>
        </submenu>
    </item>
</data>

Still I can confirm that it sets width 10 times bigger that is stated.

Thank you, moving “config” up helped.

One more question: is this a bug, or a feature, when width setting via config for context menu needs to be 250, but for sub-menu 25?

Also, what tags do you use to format XML the way you did in your replay?

Thanks.

  1. It’s a bug.


thank you

You can login to client area and grab Webix 2.0.2, it contains fix for the above issue.

The fix is confirmed. Thank you.