I have an OData model with a property column 'category'. In twenty rows are i. e. 3 different categories. Now I want to display a list of all different categories to use as filter for a table. How can I do that?
Thanks
I started to answer this earlier today but then didnt complete it as it may not be a full answer but this certainly is a good place to start...
Two options I guess: get a function import that just returns a set of the categories and push the problem to the server.
Or process on the client side by using reduce on the column in question.
The best way to do that is explained here.
So adapting that answer:
var categories = ["SAPUI5","OpenUI5","JavaScript","NodeJS","SAP HANA","JavaScript","SAPUI5"];
var uniq = categories.reduce(function (a,b) {
if (a.indexOf(b) < 0 ) a.push(b);
return a;
}, []);
console.log(uniq); // ["SAPUI5", "OpenUI5", "JavaScript", "NodeJS", "SAP HANA"]