mazdik / ng-mazdik

Angular UI component library
https://mazdik.github.io/ng-mazdik
MIT License
89 stars 34 forks source link

Update/Filter column values #33

Closed suryakanta101 closed 5 years ago

suryakanta101 commented 5 years ago

@mazdik Is there any way to update the column values based on Filter condition. Example: Toggle Button to decide to Show the Column result either in Percentage or in Number.

Expectation

<ng-template #column4 let-row="row" let-value="value" let-column="column"> {{row.totalCount}} </ng-template>

On filter change "{{row.totalCount}}" need to replace by "{{row.Percentage}}"

mazdik commented 5 years ago

Try something like this:

{{(condition) ? row.totalCount : row.Percentage}}

On filter change

    this.table.events.onRowsChanged();
    this.table.events.onResizeEnd(); // if columns change
mazdik commented 5 years ago

this.table.events are not needed

    <ng-template #headerCellTemplate let-column="column">
      <span>{{column.title}}</span>
      <span (click)="state = !state" style="cursor: pointer; padding-left: 5px;">{{(state) ? '%': 'num'}}</span>
    </ng-template>
    <ng-template #cellTemplate let-row="row" let-value="value">
      {{(state) ? '100%' : value}}
    </ng-template>