ggmod / angular-2-data-table

An Angular 2 data table, with pagination, sorting, expandable rows, row selection etc.
69 stars 136 forks source link

Sorting based on value of cell (without property) #23

Closed Sarasper closed 6 years ago

Sarasper commented 7 years ago
<data-table-column
            [property]="'wins'"
            [header]="'Wins'"
            [sortable]="true">
</data-table-column>
<data-table-column
           [header]="'Win Rate'">  <!-- [cellColors]="cellColor" -->
           <ng-template #dataTableCell let-item="item">
                <span>{{item.wins  | rating: item.totalGames}}</span>
           </ng-template>
 </data-table-column>

I am able to sort wins column since I can assign property and sortable inputs. But for win rate, I dont have any property value and it looks like sorting only works with property input.

I calculate win rate with pipe and show it. Is there a way to sort columns like this ?

duard commented 7 years ago

Didi you know how to sort in the component ?

let params = 'what I need to write here to sort records ?'
this.regs.query(params).then(films => this.regs = films);

I want to sort by code