Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

315
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda