+ Start a Discussion

Filter List Based on multiple Fields on Component

I am trying to understand how I code my controller to handle multiple fields on a component used to sort my list.  I have 6 lightning:select fields on my component that I want to use to filter down my list attribute.  I'm using this for one of the fields (which works fine)  However, I'm struggling how to further filter the "filter" list so that it removes any that don't meet the other field criteria.  Any help is greatly appreciated!!!!!!

if(selectedGroupNum != '' && selectedGroupNum != "All") {
                 if(c.Group_Number__c == selectedGroupNum){
                           filter[k] = c;
                     //console.log('!!! 2 filter' + JSON.stringify(filter[k]));

//Set the filtered list of contacts based on the selected option
         component.set("v.groupstructures", filter);
Raj VakatiRaj Vakati
You can set them in the attribute and get the data to filter ... as you want to sort more values sometime in memory manipulation causes  unwanted errors 

Refer this link