Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Mark Ritter on Nov 09, 2008 20:40
open dhtmlx forum
Open menu UP

I want to use xMenu as a replacement for a combo box (not an xCombo) (need submenus) that is near the bottom of the window, not at the top like a regular menu. So when it is opened it gets cut off. Is there a way to say open UP, not down?

Will have to also open UP sub-menus, also.

If it could decide automatically would be best.
Answer posted by Support on Nov 10, 2008 03:46
Edit the dhtmlxmenu.js file:

this._showPolygon = function(id, openType) {
    // add first line
    if (openType == "bottom") { openType = "top"; }
    ...
}


Sub-menues could also be assigned to different openType, but global behaviour could be broken.
Use it at your risk.
Answer posted by Mark Ritter on Nov 10, 2008 16:01

Thanks.  That did work.  But I can't use it since it will make my menu bar at the top also open upwards.  Will have to do some more thinking.

 

Answer posted by Support on Nov 11, 2008 00:30
Right,

try this code:

add 3rd parameter into constructor like this:

function dhtmlXMenuObject(baseId, skin, openUp) {
    ...
    // also add this
    this.openUp = ( openUp === true ? true : false );
    ...

then edit the this._showPolygon function:

this._showPolygon = function(id, openType) {
    // add first line
    if (openType == "bottom" && this.openUp == true) { openType = "top"; }
    ...
}

And now init top menu using usual way, and bottom menu passing true into 3rd argument.
Answer posted by Mark Ritter on Nov 11, 2008 17:20

That works great.  Now, can you also do the same for the sub-menus?

Thank you!

Answer posted by Support on Nov 12, 2008 02:40
Could you please attach any paint of how do you imagine this?
It needed for fixing positioning algorithm.
Answer posted by Mark Ritter on Jun 09, 2009 15:08

Will this become a standard feature?  I updated to 2.1 and had to go back and do the above over again.  I could see other people using it like I do.

 

Answer posted by Alex (support) on Jun 10, 2009 02:04

Hello, 

possibly this solution will be included into the official release (but we don't yet reach a final decision).