This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Description
I am using custom fields (object properties besides id and text) in my result items to add some sugar in the templates e.g. to show an icon or sub-texts .
Now when rendering each item in the results drowdown my own resultItem template method only receives the 'cleaned' item version created by the filterResult method here
I do understand that simply using the input item may be a problem if it has children. So how about creating the result by copying the original item without the children key. I found this object destructing infos here and the code may end up with something like this:
filterResults(results) {
results = results.map(function(item) {
const { children, ...result } = item;
if (children) {
result["children"] = this.filterResults(children);
}
return result;
}, this);
return results.filter(function(item) {
return !Selectivity.findById(this._data, item.id);
}, this);
},
I am upgrading from the old v2 atm and started using you lib in a plain manner(no jquery/react wrapper) and try to not override your base class or create new classes for every one of my differing selects. Instead i am using a factory class shuffling the options and some custom templates. Had quite a struggle to figure all those requires out ;-)