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

302
Visualizações
Ionic/Angluar NGX Datatable: Transform boolean values to string

I am developing an Ionic/Angular application and I am using NGX datatable. It works pretty good, but I need to display the boolean values of one column not as "true" or "false" (English language) - I need to display the boolean values in German ("true" = "Ja" , "false" = "Nein").

The problem is that I am using the automatically generating columns, so my datatable in html looks like this:

<ngx-datatable [selectionType]="'single'" (select)="openDetailsPage($event)" [messages]="messages"
        class="bootstrap" [limit]="10" [rows]="allOpenTickets" [rowHeight]="50" [columns]="columns"
        [columnMode]="'force'" [sortType]="'multi'" [headerHeight]="50" [footerHeight]="50"
        [rowClass]="getRowClass">
</ngx-datatable>

And i define my columns in typescript like:

this.columns = [
    { name: 'Id', prop: 'id' },
    { name: 'Ziel', prop: 'goalDate', pipe: this.datePipe() },
    { name: 'Erstellt', prop: 'created' , pipe: this.datePipe() },
    { name: 'Titel', prop: 'title' },
    {name:'Erledigt',prop:'done'}
];

As you can see, I use a datetipe to transform the date, is there something like a pipe for boolean values? Or should I not use the automatically generated columns and instead create my own?

My final table should look like this: final table picture

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use any kind of pipe you desire to transform the data - even your custom pipe (as per docs here). This is the signature of a PipeTransform.

So you probably want something along the lines of:

germanBooleanPipe(): PipeTransform {
  return {
    transform: (value: boolean) => value ? "Ja" : "Nein";
}

And apply that pipe to your column:

this.columns = [
    { name: 'Id', prop: 'id' },
    { name: 'Ziel', prop: 'goalDate', pipe: this.datePipe() },
    { name: 'Erstellt', prop: 'created' , pipe: this.datePipe() },
    { name: 'Titel', prop: 'title' },
    { name:'Erledigt', prop:'done', pipe: this.germanBooleanPipe() }
];

Note that I've never used ngx-datatable myself, so this might need some minor adjustments.

about 4 years ago · Juan Pablo Isaza 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