mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
Fix selectize bug when multiple selectize fields exist on the same page
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
{# SET WIDGET #}
|
||||
{% set oDataProvider = oUIBlock.GetDataProvider() %}
|
||||
let optionsBeforeFilter;
|
||||
let oWidget{{ oUIBlock.GetId() }} = $('#{{ oUIBlock.GetId() }}').selectize({
|
||||
|
||||
{# Global options #}
|
||||
@@ -109,7 +108,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;
|
||||
me.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);
|
||||
@@ -203,7 +202,7 @@ let oWidget{{ oUIBlock.GetId() }} = $('#{{ oUIBlock.GetId() }}').selectize({
|
||||
|
||||
onBlur: function(){
|
||||
this.clearOptionGroups()
|
||||
this.addOption(optionsBeforeFilter)
|
||||
this.addOption(this.optionsBeforeFilter)
|
||||
},
|
||||
|
||||
{# plugin combodo_add_button #}
|
||||
|
||||
Reference in New Issue
Block a user