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

321
Visualizações
How to sort primeNg table with nested columns structure?

I am using primeNg . I want to implement sorting of data. The problem is that I have a column data structure where some columns have a superColumn type and that means they are divided for a set of subColumns. It works well for presenting but I have a problem with sorting it. It is never sorted on basis of the subcolumn field value but on the basis of the parent column (supercolumn) field value. That means it is taking what is in the [pSortableColumn] attribute instead of what is in the [field] attribute of the sorting icon.

Is there any way I could resolve that? This is my code below (I removed styling):

<th
    *ngFor="let col of columns; let i = index;"
    pResizableColumn
    pReorderableColumn
    [pSortableColumn]="col.field"
    [pSortableColumnDisabled]="col.showSort === false"
>
    <ng-container *ngIf="col.type !== 'superColumn'">
        <span>{{ col.header }}</span>
        <p-sortIcon [field]="col.field"></p-sortIcon>
    </ng-container>

    <ng-container *ngIf="col.type === 'superColumn'">
        <div>{{ col.header }}</div>
        <ng-container *ngFor="let subColumn of col.subColumns">
            <div>
                {{ subColumn.header }}
                <p-sortIcon [field]="subColumn.field"></p-sortIcon>
            </div>
        </ng-container>
    </ng-container>
</th> 
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