Hello,
We are trying to implement a drop down menu(s), which allows me to select a entry out of a supergroup.
When searching for the object with this indexfield(s) we need to be able to search it by it's supergroup.
What we have tried so far:
- Using a layered catalog.
We created a catalog with this structure:
This would be exactly what we need. Sadly though when searching for "Unterhaltungselektronik", there are no results even though there are objects with the type "Unterhaltungselektonik/Tonaufzeichungsgeräte" in existence, which makes the layered approach not viable.
I have been told by OS today, that this is in fact intended behavior, so this is not an option for us.
- Using a filter.
We have tried to filter the catalog above to match our criteria. To do this we have a second catalog that matches all the INNERENTRYs of the catalog above.
When selecting one of the supergroups we want to delete all the entries in the catalog except for the LEAFENTRIES of the respectable supergroup.
This is the code we have used to try to achieve this:
scope.model.produktgruppenkatalog.applyFilter(function(entry) {
console.log(entry.data + ": " + entry.type);
return true;
});
var isProduktgruppe = false;
scope.model.produktobergruppenkatalog.onchange = function() {
scope.model.produktgruppenkatalog.applyFilter(function(entry) {
console.log(entry.data + ": " + entry.type);
if(entry.type === 'LEAFENTRY' && isProduktgruppe){
return true;
}
isProduktgruppe = false;
if(entry.data == scope.model.produktobergruppenkatalog.value)
isProduktgruppe = true;
return false;
});
}
This produces folloing console statements: http://prntscr.com/kjfmq3
The top part is the initally filter that just returns true. In the bottom half it shows, that there is only INNERENTRIES in the catalog.
I'm quite certain that this is because the catalog instantly filters out all the LEAFENTRIES, right after I fitler out the supergroup, which makes this approach also fail.
- Microservice
Currently we are using a microservice to solve this problem. This way we can get both cataloges with REST Calls and create a list of the entries we need out of is (depending on the value in "Produktobergruppen"). Then we can fill a dynamic list with the result.
This approach works, but seems way to complicated from a technical POV to me. I'd love to reduce the complexity of our system and get rid of this.
We could technically do the same in JavaScript, but that seems to be too much logic for a form Script for my taste.
Does anyone have an idea, how we solve this problem smoothly?
Thanks :)