submenu¶
-
class
webix.ui.
submenu
(data)¶ Arguments: - data (object) – A configuration object
Submenu view.
Referenced by¶
- views
contextmenu()
.
External references¶
Code¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | webix.protoUI({
name:"submenu",
$init:function(){
this._body_cell = webix.clone(this._dummy_cell_interface);
this._body_cell._view = this;
this.attachEvent('onMouseOut',function(){
if (this.getTopMenu()._settings.openAction == "click")
return;
if (!this._child_menu_active && !this._show_on_mouse_out)
this.hide();
});
//inform parent that focus is still in menu
this.attachEvent('onMouseMoving',function(){
if (this._parent_menu)
webix.$$(this._parent_menu)._child_menu_active = true;
});
this.attachEvent("onBeforeShow", function(){
if (this.getTopMenu()._autowidth_submenu && this.sizeToContent && !this.isVisible())
this.sizeToContent();
});
this._dataobj.setAttribute("role", "menu");
},
$skin:function(){
webix.ui.menu.prototype.$skin.call(this);
webix.ui.popup.prototype.$skin.call(this);
this.type.height = webix.skin.$active.menuHeight;
},
_dummy_cell_interface : {
$getSize:function(dx, dy){
//we saving height and width, as list can hardcode new values
var h = this._view._settings.height*1;
var w = this._view._settings.width*1;
var size = webix.ui.menu.prototype.$getSize.call(this._view, dx, dy);
//restoring
this._view._settings.height = h;
this._view._settings.width = w;
return size;
},
$setSize:function(x,y){
if (this._view._settings.scroll)
this._view._bodyobj.style.height = y+"px";
},
destructor:function(){ this._view = null; }
},
//ignore body element
body_setter:function(){
},
getChildViews:function(){ return []; },
defaults:{
width:150,
subMenuPos:"right",
layout:"y",
autoheight:true
},
type:{
height: webix.skin.menuHeight,
subsign:true
}
}, webix.ui.menu, webix.ui.popup);
|