Primeng: Use pipes and directives with dynamic columns in new TurboTable

Created on 20 Jan 2018  路  1Comment  路  Source: primefaces/primeng

There is no guarantee in receiving a response in GitHub Issue Tracker, If you'd like to secure our response, you may consider PrimeNG PRO Support where support is provided within 4 business hours

I'm submitting a ... (check one with "x")

[] bug report => Search github for a similar issue or PR before submitting
[X ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

99% of all times in an HTML table you need to run directives such as formatting or changing negative values etc as well as other functions that are covered by pipes and directive (custom and builtin).
There should be a way to use pipes and directives in the new turbotable when using dynamic columns.

>All comments

You can use ngSwitch for an example, here is dynamic columns with different filter elements for header;

<th *ngFor="let col of columns" [ngSwitch]="col.field">
                    <input *ngSwitchCase="'vin'" pInputText type="text" (input)="dt.filter($event.target.value, col.field, col.filterMatchMode)">
                    <div *ngSwitchCase="'year'">
                        {{yearFilter}}
                        <i class="fa fa-close" (click)="yearFilter=null;dt.filter(null, col.field, col.filterMatchMode)" style="cursor:pointer"></i>
                        <p-slider [style]="{'width':'100%','margin-top':'8px'}" [(ngModel)]="yearFilter" [min]="1970" [max]="2010" (onChange)="onYearChange($event, dt)"></p-slider>
                    </div>
                    <p-dropdown *ngSwitchCase="'brand'" [options]="brands" [style]="{'width':'100%'}" (onChange)="dt.filter($event.value, col.field, 'equals')"></p-dropdown>
                    <p-multiSelect *ngSwitchCase="'color'" [options]="colors" defaultLabel="All Colors" (onChange)="dt.filter($event.value, col.field, 'in')"></p-multiSelect>
                </th>

Same applies to body as well so you can change what to display per column body e.g. pipes ...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jisqaqov picture jisqaqov  路  3Comments

KannanMuruganmony picture KannanMuruganmony  路  3Comments

lilling picture lilling  路  3Comments

gatapia picture gatapia  路  3Comments

SchneMa picture SchneMa  路  3Comments