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

184
Views
Keyup filter table

I have a user table that is currently filtered by groups - the users are assigned a group when they are added. I have an updateFilter function which searches by the users last name. The issue I'm currently having is when a group is selected, the users are shown, but when I search for a name and delete the searched characters for another name, the full list appears when I need it to only show and return whatever group is selected.

Search div -

<div class="col-4">
   <input
     type='text'
     class="form-control w-200px"
     placeholder='Search by Last Name...'
     (keyup)='updateFilter($event)'/>
 </div>

Filter function -

  updateFilter(event) {
    const val = event.target.value.toLowerCase();

    this.rows = this.temp.filter(function (d) {
      return d.lastName.toLowerCase().indexOf(val) !== -1 || !val;
    });

    if (this.table) {
      this.table.offset = 0;
    }
  }

Group filter -

onGroupSelected($event) {
    const groupId = $event.target ? $event.target.value : $event;
    if (groupId === 'none') {
      this.rows = this.temp;
    } else {
      const groupUsers = this.groupUserMap.get(groupId);
      if (groupUsers) {
        this.rows = this.temp.filter((serviceUser) => groupUsers.includes(serviceUser.id));
      } else {
        this.rows = [];
      }
    }
    // @ts-ignore
    this.userSelections = this.userSelections ? this.userSelections : {};
    this.userSelections.groupId = groupId;
    localForage.setItem(this.username, this.userSelections);
  }
about 4 years ago · Juan Pablo Isaza
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!