Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Commit

Permalink
Fixes issue #222: error when multiple is activated and options do not…
Browse files Browse the repository at this point in the history
… all have children
  • Loading branch information
Mathieu Sabourin committed Mar 9, 2018
1 parent 678aa99 commit bd884bc
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/inputs/multiple.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,16 @@ var callSuper = Selectivity.inherits(MultipleInput, Selectivity, {
* @inherit
*/
filterResults: function(results) {
var hasChildren = results.some(function(item) {
return item.children;
});
if (hasChildren) {
results = results.map(function(item) {
return {
id: item.id,
text: item.text,
children: this.filterResults(item.children)
};
}, this);
}
results = results.map(function(item) {
const result = {
id: item.id,
text: item.text,
};
if (!!item.children) {
result['children'] = this.filterResults(item.children);
}
return result;
}, this);

return results.filter(function(item) {
return !Selectivity.findById(this._data, item.id);
Expand Down

0 comments on commit bd884bc

Please sign in to comment.