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.
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.
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.
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.
That works great. Now, can you also do the same for the sub-menus?
Thank you!
Could you please attach any paint of how do you imagine this?
It needed for fixing positioning algorithm.
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.
Hello,
possibly this solution will be included into the official release (but we don’t yet reach a final decision).