table.reset() - Reset is not working on turbotable

UI Components for Angular
Post Reply
attina
Posts: 5
Joined: 21 Feb 2017, 15:34

18 Jul 2018, 08:39

Hi all,

According to the documentation from https://www.primefaces.org/primeng/#/table the reset method should "Resets sort, filter and paginator state."
The problem is that reset table method is not deleting the filters from UI. (although filters field from table.ts is {} after reset)

Please see the https://github-vmghz6.stackblitz.io/ where I reproduced it.
The code can be seen at https://stackblitz.com/edit/github-vmgh ... onent.html
Filter the Summary table (see example) by Failed field (or any other field).
Press reset. => The table values will be reset but the filter value will still be visible.

The example is with the basic table but it's also NOT working with dynamic cols.

Code: Select all

<ng-template pTemplate="header" let-columns>
    <tr>
      <th *ngFor="let col of columns" [pSortableColumn]="col.field">
        {{col.header}}
        <p-sortIcon [field]="col.field"></p-sortIcon>
      </th>
    </tr>
    <tr>
      <th *ngFor="let col of columns">
        <input pInputText type="text" (input)="dt.filter($event.target.value, col.field, 'contains')">
      </th>
    </tr>
  </ng-template>
Do you have any ideea on how I can reset the filters from the inputs?

Thank you,
Anitta

attina
Posts: 5
Joined: 21 Feb 2017, 15:34

18 Jul 2018, 14:55

fixed. https://stackblitz.com/edit/github-vmgh ... onent.html

For input fields just add [value]="dt.filters[<field>] ? dt.filters[<field>].value : ''" where <field> is the field send in the (input) method (input)="dt.filter($event.target.value,<field>, 'contains')".

For example:

Code: Select all

 <th>
        <input pInputText type="text" (input)="dt.filter($event.target.value, 'date', 'contains')"
       [value]="dt.filters['date'] ? dt.filters['date'].value : ''">
 </th>

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 13 guests