I am currently working on filtering an array of objects based on four fields from a form. These four fields can be combined for more specific filtering.
The four fields consist of two dropdowns with multiple selection options and two text boxes.
Upon clicking a button, the data should be filtered according to the selected fields using the following method:
filterData(form: NgForm) {
// Code for filtering data goes here
}
Currently, the filtering works correctly for the text box filters (Description and File Name). Users can select one or both boxes to filter the data accurately.
My challenge lies in incorporating the multiple selection filters (Type and Company). Below is an example object representing all selected filters for the search:
arrFilter = [
{
"field":"type",
"value":[
"Type1",
"Type2",
"Type3",
"Type4"
]
},
{
"field":"company",
"value":[
"CompanyA",
"CompanyB"
]
},
{
"field":"description",
"value":"Test"
},
{
"field":"name",
"value":"Test.txt"
}
]
Any suggestions on how to incorporate the multiple selection filters effectively? Your input is appreciated. Thank you.