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

1K
Visualizações
Filter PrimeNG Table on Init using .ts code

I need to filter the table on view load.

For example, I have a table with 5 columns (Woid, Customer, AdapterID, Assignee, Status). On load, I want to filter woid column using 'contains'. I accomplished filtering onLoad but when I want to filter again that column later I got an error:

[i]'Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.'[/i]

Program code below...

@ViewChild('dt', { static: true }) dt: any;
ngOnInit() {
    this.dt.filter('22', 'woid', 'contains');
}

enter image description here

Also, after filtering via .ts code (woid filter) and directly in view with <p-columnFilter> (customer filter) from PrimeNG Angular collection, I get this JSON. woid property is not an array, unlike custom which is. onFiltering method and JSON below.

onFiltering(event: any) {
    console.log('Filtered value: '+ JSON.stringify(event.filters));
}


{
    "woid": {
        "value": "22",
        "matchMode": "contains"
    },
    "customer": [{
        "value": "2",
        "matchMode": "contains",
        "operator": "and"
    }]
}
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I replaced this line of code:

this.dt.filter('22', 'woid', 'contains'); 

with this:

this.dt.filters['woid'] = [{value: "22", matchMode: "contains", operator: "and"}];

Now it works fine :)

over 4 years ago · Santiago Trujillo Relatório
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