function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Fred13Fred13 

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!!!!!!

thanks!!!
Fred
if(selectedGroupNum != '' && selectedGroupNum != "All") {
                 if(c.Group_Number__c == selectedGroupNum){
                           filter[k] = c;
                     //console.log('!!! 2 filter' + JSON.stringify(filter[k]));
                            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 

https://github.com/SalesforceLabs/EnhancedLightningGrid/blob/master/aura/SDGFieldChooser/SDGFieldChooserHelper.js