mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°7526 - Profile input unfocus: Previously entered value still filters
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
{# SET WIDGET #}
|
||||
{% set oDataProvider = oUIBlock.GetDataProvider() %}
|
||||
let optionsBeforeFilter;
|
||||
let oWidget{{ oUIBlock.GetId() }} = $('#{{ oUIBlock.GetId() }}').selectize({
|
||||
|
||||
{# Global options #}
|
||||
@@ -108,6 +109,7 @@ let oWidget{{ oUIBlock.GetId() }} = $('#{{ oUIBlock.GetId() }}').selectize({
|
||||
// Filter old options data to keep selected values
|
||||
// (options with force flag will be kept event if they doesn't be part of the current value)
|
||||
let options = Object.values(me.options);
|
||||
optionsBeforeFilter = options;
|
||||
options = options.filter(item => (typeof(item.force) !== "undefined" && item.force === true) || aSelectedItems.includes(item['{{ oDataProvider.GetDataValueField() }}']));
|
||||
// Merge kept and new values
|
||||
options = $.merge(options, res.data.search_data);
|
||||
@@ -199,6 +201,11 @@ let oWidget{{ oUIBlock.GetId() }} = $('#{{ oUIBlock.GetId() }}').selectize({
|
||||
CombodoTooltip.InitTooltipFromMarkup($item);
|
||||
},
|
||||
|
||||
onBlur: function(){
|
||||
this.clearOptionGroups()
|
||||
this.addOption(optionsBeforeFilter)
|
||||
},
|
||||
|
||||
{# plugin combodo_add_button #}
|
||||
{% if oUIBlock.HasAddOptionButton() and oUIBlock.HasAddOptionButtonJsOnClick() %}
|
||||
onAdd: function(){
|
||||
|
||||
Reference in New Issue
Block a user