Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

185
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda