I am trying to filter some records coming from my api data, i am trying to use filter but i am not sure how should i do for multipoe items.
Here is my code the api response i have and what happens when i do a checkbox
my APi data
{
"requestId": "",
"totalRecords": 132,
"status": "SUCCESS",
"items": [
{
"Id": 3489,
"Status":"Awaiting Funds",
"amountPaid": {
"unit": "CAD",
"value": 10
},
"Name": "John Doe"
},
{
"Id": 3508
"Status":"Awaiting Funds",
"amountPaid": {
"unit": "CAD",
"value": 10
},
"Name": "John Doe"
},
{
"Id": 3503,
"Status":"Awaiting Funds",
"amountPaid": {
"unit": "CAD",
"value": 25
},
"Name": "John Sinth"
}
]
}
and in my checkbnox i am passing two checkboxes values which are full object like 3508,3503 but now sure how to do
Here is my code as to what i did but i am not getting filetered records
const parsedData = JSON.parse(JSON.stringify(this.apiData));
if (this.multipleSelection.length > 0) {
const data = parsedData.filter(function (el)
{
return el.Id = 3489 and 3503
})
} else {
const data = parsedData;
}
console.log(typeof this.apiData)what do you get?3489 and 3503is invalid JS. Please refer to some documentation.=and===