mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-02 21:51:51 +08:00
Update the Selector when a user is selected/deselected [SCI-7625]
This commit is contained in:
parent
23e50cf710
commit
dc333f77d5
1 changed files with 15 additions and 0 deletions
|
@ -708,6 +708,7 @@ var dropdownSelector = (function() {
|
|||
} else {
|
||||
// Or delete specific one
|
||||
deleteValue(selector, container, tagLabel.data('ds-tag-id'), tagLabel.data('ds-tag-group'));
|
||||
removeOptionFromSelector(selector, tagLabel.data('ds-tag-id'));
|
||||
}
|
||||
}, 350);
|
||||
}
|
||||
|
@ -871,6 +872,19 @@ var dropdownSelector = (function() {
|
|||
return result;
|
||||
}
|
||||
|
||||
function appendOptionToSelector(selector, value) {
|
||||
$(selector).append(
|
||||
`<option
|
||||
data-params=${JSON.stringify(value.params)}
|
||||
value='${value.value}'
|
||||
>${value.label}</option>`
|
||||
);
|
||||
}
|
||||
|
||||
function removeOptionFromSelector(selector, id) {
|
||||
$(selector).find(`option[value="${id}"]`).remove();
|
||||
}
|
||||
|
||||
// ////////////////////
|
||||
// Public functions ///
|
||||
// ////////////////////
|
||||
|
@ -987,6 +1001,7 @@ var dropdownSelector = (function() {
|
|||
currentData = getCurrentData($(selector).next());
|
||||
currentData.push(value);
|
||||
setData($(selector), currentData, skip_event);
|
||||
appendOptionToSelector(selector, value);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue