mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-20 14:36:34 +02:00
Add feature of passing the label through the event of add/remove item
This commit is contained in:
parent
4f61ac5e7a
commit
34e8a430e1
|
@ -1915,12 +1915,14 @@ class Choices {
|
||||||
triggerEvent(this.passedElement, 'addItem', {
|
triggerEvent(this.passedElement, 'addItem', {
|
||||||
id,
|
id,
|
||||||
value: passedValue,
|
value: passedValue,
|
||||||
|
label: passedLabel,
|
||||||
groupValue: group.value,
|
groupValue: group.value,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
triggerEvent(this.passedElement, 'addItem', {
|
triggerEvent(this.passedElement, 'addItem', {
|
||||||
id,
|
id,
|
||||||
value: passedValue,
|
value: passedValue,
|
||||||
|
label: passedLabel,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1942,6 +1944,7 @@ class Choices {
|
||||||
|
|
||||||
const id = item.id;
|
const id = item.id;
|
||||||
const value = item.value;
|
const value = item.value;
|
||||||
|
const label = item.label;
|
||||||
const choiceId = item.choiceId;
|
const choiceId = item.choiceId;
|
||||||
const groupId = item.groupId;
|
const groupId = item.groupId;
|
||||||
const group = groupId >= 0 ? this.store.getGroupById(groupId) : null;
|
const group = groupId >= 0 ? this.store.getGroupById(groupId) : null;
|
||||||
|
@ -1952,12 +1955,14 @@ class Choices {
|
||||||
triggerEvent(this.passedElement, 'removeItem', {
|
triggerEvent(this.passedElement, 'removeItem', {
|
||||||
id,
|
id,
|
||||||
value,
|
value,
|
||||||
|
label,
|
||||||
groupValue: group.value,
|
groupValue: group.value,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
triggerEvent(this.passedElement, 'removeItem', {
|
triggerEvent(this.passedElement, 'removeItem', {
|
||||||
id,
|
id,
|
||||||
value,
|
value,
|
||||||
|
label,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue