VadimDez / ngx-order-pipe

▼ Angular 5+ orderBy pipe
https://vadimdez.github.io/ngx-order-pipe/
MIT License
243 stars 57 forks source link

Clarification on deep property sorting. #29

Closed CD-UNCC closed 6 years ago

CD-UNCC commented 6 years ago

It appears on the page a comma delimited list is specified but I can only see a period separated for the example. Either way I cannot seem to sort on a nested property. My code is

    <tr *ngFor="let loc of locationsPage | orderBy: order: reverse; let i = index">
                        <td>{{i + 1}}</td>
                        <td>{{loc.customer.customerName}}</td>
<th (click)="orderBy('customer.customerName')">Customer</th>

oderBy() sets the order key in the *ngFor

orderBy(order: string) {
        if (order === this.order) {
            this.reverse = !this.reverse;
        } else {
            this.order = order;
            this.reverse = false;
        }
    }

I have many nested properties in my table. I need to sort on a few of them. Is this possible using ng2-order-pipe? If so what is incorrect about my code above? Thank you for reading.

VadimDez commented 6 years ago

It seems like you're using old package. Try to use ngx-order-pipe instead.

VadimDez commented 6 years ago

@CD-UNCC any updates? is it working now?

CD-UNCC commented 6 years ago

We are all good there! @VadimDez thank you!