mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-09 13:28:53 +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 {
|
} else {
|
||||||
// Or delete specific one
|
// Or delete specific one
|
||||||
deleteValue(selector, container, tagLabel.data('ds-tag-id'), tagLabel.data('ds-tag-group'));
|
deleteValue(selector, container, tagLabel.data('ds-tag-id'), tagLabel.data('ds-tag-group'));
|
||||||
|
removeOptionFromSelector(selector, tagLabel.data('ds-tag-id'));
|
||||||
}
|
}
|
||||||
}, 350);
|
}, 350);
|
||||||
}
|
}
|
||||||
|
@ -871,6 +872,19 @@ var dropdownSelector = (function() {
|
||||||
return result;
|
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 ///
|
// Public functions ///
|
||||||
// ////////////////////
|
// ////////////////////
|
||||||
|
@ -987,6 +1001,7 @@ var dropdownSelector = (function() {
|
||||||
currentData = getCurrentData($(selector).next());
|
currentData = getCurrentData($(selector).next());
|
||||||
currentData.push(value);
|
currentData.push(value);
|
||||||
setData($(selector), currentData, skip_event);
|
setData($(selector), currentData, skip_event);
|
||||||
|
appendOptionToSelector(selector, value);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue