How to get a drop down in the inline filter with unique values from the grid. For example my JSON returns 100 rows of Person object. That has 5 columns. I want to filter all these columns. I want 3 columns to be text box and other 2 columns to be drop down. Here in the example there are 4 rows, I want to display only the 3 unique values (i.e. 'Dog', 'Cat' and 'Lizard') in the Pet filter and that should be a drop down. (Note: don't want to display 'Dog' twice the drop down). And upon selection of a value from the drop down, the table should refresh accordingly. Similarly for Active column where it should have only 2 values (i.e. true and false) in the drop down.
createFilter(): (data: any, filter: string) => boolean {
let filterFunction = function(data, filter): boolean {
let searchTerms = JSON.parse(filter);
return data.name.toLowerCase().indexOf(searchTerms.name) !== -1
&& data.id.toString().toLowerCase().indexOf(searchTerms.id) !== -1
&& data.colour.toLowerCase().indexOf(searchTerms.colour) !== -1
//&& data.active.toLowerCase().indexOf(searchTerms.active) !== -1 ??? How to write this ???
&& data.pet.toLowerCase().indexOf(searchTerms.pet) !== -1;
}
return filterFunction;
}