For Example
selectedOptions = [
{
id: 2,
name: 'Children'
}
]
this.filteredTableData = this.tableData.filter((pdo) => {
return pdo.pdo_advocacies.some((advocacy) => {
return advocacy.pdo_programs.some((program) => {
return selectedOptions.some((option) => {
console.log(option.name);
console.log(program.program_category?.name);
// Check if program_category is null or undefined
if (program.program_category === null || program.program_category === undefined) {
// Check if the option name is 'null'
return option.name === 'null';
}
// Compare the program category name with the selected option name
return option.name === program.program_category.name;
});
});
});
});
Should return only the programs with Children beneficiaries but currently it returns the whole PDO object.
Code Sample: https://stackblitz.com/edit/stackblitz-starters-azu5d2?file=src%2Fmain.ts
1