Fix menu focus in ComboDataView

This commit is contained in:
Julia Radzhabova 2021-09-20 01:41:38 +03:00
parent 5fa14b63fe
commit 754bc9c8bc
3 changed files with 8 additions and 7 deletions

View file

@ -114,20 +114,17 @@ define([
offset: [0, 3], offset: [0, 3],
items: [ items: [
{template: _.template('<div class="menu-picker-container"></div>')} {template: _.template('<div class="menu-picker-container"></div>')}
] ].concat(this.options.additionalMenuItems != null ? this.options.additionalMenuItems : [])
}), }),
dataHint: this.options.dataHint, dataHint: this.options.dataHint,
dataHintDirection: this.options.dataHintDirection, dataHintDirection: this.options.dataHintDirection,
dataHintOffset: this.options.dataHintOffset dataHintOffset: this.options.dataHintOffset
}); });
if (this.options.additionalMenuItems != null) {
this.openButton.menu.items = this.openButton.menu.items.concat(this.options.additionalMenuItems)
}
this.menuPicker = new Common.UI.DataView({ this.menuPicker = new Common.UI.DataView({
cls: 'menu-picker', cls: 'menu-picker',
parentMenu: this.openButton.menu, parentMenu: this.openButton.menu,
outerMenu: this.options.additionalMenuItems ? {menu: this.openButton.menu, index: 0} : undefined,
restoreHeight: this.menuMaxHeight, restoreHeight: this.menuMaxHeight,
style: 'max-height: '+this.menuMaxHeight+'px;', style: 'max-height: '+this.menuMaxHeight+'px;',
enableKeyEvents: this.options.enableKeyEvents, enableKeyEvents: this.options.enableKeyEvents,
@ -143,6 +140,10 @@ define([
delayRenderTips: this.delayRenderTips delayRenderTips: this.delayRenderTips
}); });
if (this.options.additionalMenuItems != null) {
this.openButton.menu.setInnerMenu([{menu: this.menuPicker, index: 0}]);
}
// Handle resize // Handle resize
setInterval(_.bind(this.checkSize, this), 500); setInterval(_.bind(this.checkSize, this), 500);

View file

@ -830,7 +830,7 @@ define([
}, },
focus: function(index) { focus: function(index) {
this.cmpEl && this.cmpEl.find('.dataview').focus(); $(this.el).find('.inner').addBack().filter('.inner').focus();
if (typeof index == 'string') { if (typeof index == 'string') {
if (index == 'first') { if (index == 'first') {
this.selectByIndex(0, true); this.selectByIndex(0, true);

View file

@ -536,7 +536,7 @@ define([
if (this.options.innerMenus || !menus) return; if (this.options.innerMenus || !menus) return;
this.options.innerMenus = menus; this.options.innerMenus = menus;
this.options.innerMenus && this.on('keydown:before', _.bind(this.onBeforeKeyDown, this)); this.rendered && this.on('keydown:before', _.bind(this.onBeforeKeyDown, this));
}, },
findInnerMenu: function(direction, index, findOuter) { findInnerMenu: function(direction, index, findOuter) {