ListView sort items alphabetically


#1

Is it possible to order items inside a listview by there name?

    <ListView [items]="authorArray" visibility="{{showSpinner ? 'collapsed' : 'visible'}}" seperatorColorProperty="white" iosEstimatedRowHeight="50"  (itemTap)="goToAuthorDetail($event)" class="list-group">
            <ng-template let-item="item" let-odd="odd" let-even="even">
              <StackLayout (tap)="goToAuthorDetail(item)" orientation="horizontal" class="list-group-item">
                    <Label text="&#xf007;" class="fa"></Label>  
                    <Label class="author" [text]="item.firstName"></Label>
                    <Label class="authorLastName"[text]="item.lastName"></Label>
              </StackLayout>
            </ng-template>
        </ListView>

#2

There is a sorting function but why don’t you sort the source array itself when that could be easier and if that suits your requirement.


#3

Thanks! Yeah that’s probably the easiest way :slight_smile: