Skip to content

Commit

Permalink
Add feature of passing the label through the event of add/remove item
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Mar 1, 2017
1 parent 4f61ac5 commit 34e8a43
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions assets/scripts/src/choices.js
Original file line number Diff line number Diff line change
Expand Up @@ -1915,12 +1915,14 @@ class Choices {
triggerEvent(this.passedElement, 'addItem', {
id,
value: passedValue,
label: passedLabel,
groupValue: group.value,
});
} else {
triggerEvent(this.passedElement, 'addItem', {
id,
value: passedValue,
label: passedLabel,
});
}

Expand All @@ -1942,6 +1944,7 @@ class Choices {

const id = item.id;
const value = item.value;
const label = item.label;
const choiceId = item.choiceId;
const groupId = item.groupId;
const group = groupId >= 0 ? this.store.getGroupById(groupId) : null;
Expand All @@ -1952,12 +1955,14 @@ class Choices {
triggerEvent(this.passedElement, 'removeItem', {
id,
value,
label,
groupValue: group.value,
});
} else {
triggerEvent(this.passedElement, 'removeItem', {
id,
value,
label,
});
}

Expand Down

0 comments on commit 34e8a43

Please sign in to comment.