Skip to content

Commit

Permalink
Merge pull request #2 from yanxiaodi/master
Browse files Browse the repository at this point in the history
Sort listData to get a correct order first.
  • Loading branch information
zwq8299174 authored Dec 8, 2017
2 parents 26d3b2c + c558e4b commit 360239b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/alpha-scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export class AlphaScroll implements OnInit, OnChanges, OnDestroy {
});
}
ngOnChanges() {
let sortedListData: Array<any> = this.orderBy.transform(this.listData, [this.key]);
// 先对传入的listData排序 避免结果顺序乱掉
let sortedListData: Array<any> = this.orderBy.transform(_.orderBy(this.listData, x => x.initial), [this.key]);
let groupItems: any = _.groupBy(sortedListData, item => {
let letter: any = _.get(item, this.key);
return letter.toUpperCase().charAt(0);
Expand Down

0 comments on commit 360239b

Please sign in to comment.