Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Alan Byrne on May 22, 2008 09:42
open dhtmlx forum
maxItems when building a menu in classic mode and by javascript (not from XML)

Is there any way to specify through javascript that the submenu should display only a limited number of menu items with the up down scroll buttons (as per the vertical menu examples). I believe that you can do this when loading the menu definition from XML using the maxItems attribute on the menu element.

In my case, I am using classic menu mode, so I want a normal horizontal menu bar, but I want the sub menu that pops up to show just a limited number of the menu items. This menu is being built from data and I cannot know how many items there will be.
Answer posted by Support on May 22, 2008 10:22

You can set the necessary limit by

menu.getPanel(id).maxItems=N;

this value will work more stabel if set before menu items added to target panel.

Answer posted by Alan Byrne on May 28, 2008 08:19
I tried your suggestion, but I cannot, no matter what I do, get the up down scrollers on submenus to work when the menu is created programatically.  The only way I can get these scrollers to appear is to load the menus from an XML file.  The nature of the menus I wish to implement is that they are data driven and potentially quite large, hence the need to have the scrollers.  Is there any way to get the scrollers working using scripting alone, no XML file.
Answer posted by Support on May 29, 2008 04:53
Please check attached sample.
It uses additional command
         aMenuBar._scrollCheck(subMenu)
To force inner scrolls.
Attachments (1)