values = (data.values.length) ? data.values : values;
if (Array.isArray(values)) {
var value;
+ var forceRemoveIcon = !data.element.disabled;
for (var i = 0, length = values.length; i < length; i++) {
value = values[i];
if (typeof value === 'string') {
value = { objectId: 0, value: value };
}
- this._addItem(elementId, value);
+ this._addItem(elementId, value, forceRemoveIcon);
}
}
},
/**
* Adds an item to the list.
*
- * @param {string} elementId input element id
- * @param {object} value item value
+ * @param {string} elementId input element id
+ * @param {object} value item value
+ * @param {?boolean} forceRemoveIcon if `true`, the icon to remove the item will be added in every case
*/
- _addItem: function(elementId, value) {
+ _addItem: function(elementId, value, forceRemoveIcon) {
var data = _data.get(elementId);
var listItem = elCreate('li');
content.textContent = value.value;
listItem.appendChild(content);
- if (!data.element.disabled) {
+ if (forceRemoveIcon || !data.element.disabled) {
var button = elCreate('a');
button.className = 'icon icon16 fa-times';
button.addEventListener(WCF_CLICK_EVENT, _callbackRemoveItem);