Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
¿Puedo cambiar de alguna manera el orden de las tablas que se mostrarán?

tengo tres mesas

 <table class="table1"> ... <tbody> <tr *ngFor="let data of datasource1"> ... </tr> </tbody> </table> <table class="table2"> ... <tbody> <tr *ngFor="let data of datasource2"> ... </tr> </tbody> </table> <table class="table3"> ... <tbody> <tr *ngFor="let data of datasource3"> ... </tr> </tbody> </table>

y de alguna manera quiero tener el control de qué tabla debe mostrarse en qué orden, es decir, primero table3 luego table1 luego table2 (o algún otro orden). ¿Como podría hacerlo?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Se pueden crear plantillas para cada tabla y representarlas en el orden requerido según una condición.

Crear plantillas de tablas:

 <ng-template name="table1"> <table class="table1"> ... <tbody> <tr *ngFor="let data of datasource1"> ... </tr> </tbody> </table> </ng-template> ... similarly for table2, 3

Supongo que hay un order variable en su archivo component.ts que define el orden a usar. Y

  1. Si su valor es 1: el orden de las tablas es 1, 2, 3
  2. Si su valor es 2: el orden es 2, 3, 1
  3. Si su valor es 3: el orden es 3, 1, 2

Entonces, el html para representar en el orden requerido podría ser uno de los siguientes según su caso

1.

 <ng-container *ngIf="order === 1"> <ng-container *ngTemplateOutlet="table1"> <ng-container *ngTemplateOutlet="table2"> <ng-container *ngTemplateOutlet="table3"> </ng-container> <ng-container *ngIf="order === 2"> <ng-container *ngTemplateOutlet="table2"> <ng-container *ngTemplateOutlet="table3"> <ng-container *ngTemplateOutlet="table1"> </ng-container> Note: *ngIf needs to be updated with required condition .... other conditions
 <ng-container *ngTemplateOutlet="order === 1 ? table1 : order === 2 ? table2 : table3"> <ng-container *ngTemplateOutlet="order === 1 ? table2 : order === 2 ? table3 : table1"> <ng-container *ngTemplateOutlet="order === 1 ? table3 : order === 2 ? table1 : table2">
over 4 years ago · Santiago Trujillo Report

0

Puede usar CSS, envolver las tablas en un div y aplicar flex box - display: flex; Asigne a cada mesa un orden - orden: 0; orden: 1; y así.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!