Using a multi select dropdown where i have an array of objects where i want to filter it out based on user input such as
[{
"ServiceArea": "NON-CIO",
"ManagingDirector": "qwe",
"Lead": "abc",
"Manager": "xyz"
},
{
"ServiceArea": "NON-CIO",
"ManagingDirector": "dfg",
"Lead": "hgf",
"Manager": "lkj"
},
{
"ServiceArea": "NON-CIO",
"ManagingDirector": "qwe",
"Lead": "poi",
"Manager": "uyt"
},
{
"ServiceArea": "4500-CIO",
"ManagingDirector": "yhh",
"Lead": "trr",
"Manager": "nbb"
}
]
Custom user input 1st time-
array = ["NON-CIO"]
I should be getting first three records.
Second time user inputs
array = ["dgf","qwe"]
Here i should be getting first two records.
I am using this function but it seems to append the array not replace.
//airData is main array
array.forEach((item)=>{
var name = this.airData.filter( el=>el.ManagingDirector == item );
this.airData.push.apply(this.finalArr,name);
});