Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Joel Finkel on Feb 18, 2009 10:55
open dhtmlx forum
dhtmlxMenu: Context Menu positioning

Regarding the dhtmlxMenu when used as a Context Menu and attached to a region:

If that region fills to the bottom of the window, instantiating the menu by right-clicking causes the menu to be clipped and scrollbars to appear. The top-left corner of the menu always appears at the cursor position. In most cases, this is correct. But it should be the bottom-left corner in some circumstances (depending on the height of the menu and window.innerHeight).

Thanks,
Joel
Answer posted by Support on Feb 20, 2009 07:29
Could you please provide completed demo to reproduce the issue?
Answer posted by Joel Finkel on Feb 20, 2009 08:46
Here is an example.  If you right-click near the bottom of the area you will see that the context menu extends below the client area.  Scroll bars appear, and one must scroll to view the menu.  This makes it difficult to attach the context menu to a tree and allow the user to right-click on a tree node to invoke the options on that node (if that node is near the bottom of the screen).

/Joel Finkel
Attachments (1)
Answer posted by Support on Feb 23, 2009 08:03
Right,

You should do the following:
<div id="area" style="position:relative; border:1px solid green; background-color:gray; width:800px; height:600px"></div>

Also "Visible Area" may be interesting for you, here is a demo:
http://dhtmlx.com/docs/products/dhtmlxMenu/samples/init/visible_area.html?un=1235405354000
Answer posted by Joel Finkel on Feb 23, 2009 09:17
Setting the position:relative had no effect in either FF or IE.  However, it is very good to learn about the menu.setVisibleArea(), which is exactly what I need, and which solves the issue.

Thanks,
Joel