[SSE] Show validation list
This commit is contained in:
parent
5e39627c87
commit
64569ba4b5
|
@ -311,6 +311,7 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onFormulaInfo', _.bind(this.onFormulaInfo, this));
|
this.api.asc_registerCallback('asc_onFormulaInfo', _.bind(this.onFormulaInfo, this));
|
||||||
this.api.asc_registerCallback('asc_ChangeCropState', _.bind(this.onChangeCropState, this));
|
this.api.asc_registerCallback('asc_ChangeCropState', _.bind(this.onChangeCropState, this));
|
||||||
this.api.asc_registerCallback('asc_onInputMessage', _.bind(this.onInputMessage, this));
|
this.api.asc_registerCallback('asc_onInputMessage', _.bind(this.onInputMessage, this));
|
||||||
|
this.api.asc_registerCallback('asc_onValidationListMenu', _.bind(this.onValidationListMenu, this));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
@ -3230,6 +3231,56 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onValidationListMenu: function(textarr) {
|
||||||
|
if (textarr && textarr.length>0) {
|
||||||
|
var me = this,
|
||||||
|
documentHolderView = me.documentHolder,
|
||||||
|
menu = documentHolderView.validationMenu,
|
||||||
|
menuContainer = documentHolderView.cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id));
|
||||||
|
|
||||||
|
for (var i = 0; i < menu.items.length; i++) {
|
||||||
|
menu.removeItem(menu.items[i]);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
|
||||||
|
_.each(textarr, function(menuItem, index) {
|
||||||
|
var mnu = new Common.UI.MenuItem({
|
||||||
|
caption : menuItem
|
||||||
|
}).on('click', function(item, e) {
|
||||||
|
// me.api.asc_selectFromList(item.caption);
|
||||||
|
});
|
||||||
|
menu.addItem(mnu);
|
||||||
|
});
|
||||||
|
|
||||||
|
Common.UI.Menu.Manager.hideAll();
|
||||||
|
|
||||||
|
if (!menu.rendered) {
|
||||||
|
// Prepare menu container
|
||||||
|
if (menuContainer.length < 1) {
|
||||||
|
menuContainer = $(Common.Utils.String.format('<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>', menu.id));
|
||||||
|
documentHolderView.cmpEl.append(menuContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu.render(menuContainer);
|
||||||
|
menu.cmpEl.attr({tabindex: "-1"});
|
||||||
|
}
|
||||||
|
|
||||||
|
var coord = me.api.asc_getActiveCellCoord(),
|
||||||
|
offset = {left:0,top:0},
|
||||||
|
showPoint = [coord.asc_getX() + offset.left, (coord.asc_getY() < 0 ? 0 : coord.asc_getY()) + coord.asc_getHeight() + offset.top];
|
||||||
|
menuContainer.css({left: showPoint[0], top : showPoint[1]});
|
||||||
|
|
||||||
|
menu.show();
|
||||||
|
|
||||||
|
menu.alignPosition();
|
||||||
|
_.delay(function() {
|
||||||
|
menu.cmpEl.focus();
|
||||||
|
}, 10);
|
||||||
|
} else {
|
||||||
|
this.documentHolder.validationMenu.hide();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
SetDisabled: function(state, canProtect) {
|
SetDisabled: function(state, canProtect) {
|
||||||
this._isDisabled = state;
|
this._isDisabled = state;
|
||||||
this._canProtect = canProtect;
|
this._canProtect = canProtect;
|
||||||
|
|
|
@ -968,6 +968,14 @@ define([
|
||||||
mnu.cmpEl.removeAttr('oo_editor_input').attr('oo_editor_keyboard', true);
|
mnu.cmpEl.removeAttr('oo_editor_input').attr('oo_editor_keyboard', true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.validationMenu = new Common.UI.Menu({
|
||||||
|
maxHeight: 200,
|
||||||
|
cyclic: false,
|
||||||
|
items: []
|
||||||
|
}).on('show:after', function () {
|
||||||
|
this.scroller.update({alwaysVisibleY: true});
|
||||||
|
});
|
||||||
|
|
||||||
me.fireEvent('createdelayedelements', [me]);
|
me.fireEvent('createdelayedelements', [me]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue