Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

232
Views
How to filter array table in ng-zorro table?

I'm new to Angular.

I have a demo array like this:

for (let index = 1; index <= 100; index++) {
  this.listOfData.push([
    `Name ${index}`,
    `Math.floor(Math.random() * 100)`,
    'Employee',
  ]);
}

And I try to create a filter table with search function:

onSearch = (value) => {
  const output = this.listOfData.filter((arr) =>
    arr.some((item) => {
      item.toLowerCase().includes(value);
    })
  );
  console.log('output: ', output);
  this.listOfDisplayData = output;
};

This is my demo

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

So basically your data item is [[string,string,string],...] when you start filtering with filter you must return true for it to include and false to filter it out.

This should fix it

  onSearch = (value) => {
    const output = this.listOfData.filter((arr) =>
      arr.some((item) => {
        if (item.toLowerCase().includes(value)) {
          return true;
        } else {
          return false;
        }
      })
    );
    console.log('output: ', output);
    this.listOfDisplayData = output;
  }
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!