#328765 Sort group members by display name on group members screen.

This commit is contained in:
Georgi Prodanov 2017-02-09 18:49:16 +02:00
Родитель 635e53f20f
Коммит efac79e4ae
2 изменённых файлов: 15 добавлений и 1 удалений

Просмотреть файл

@ -42,7 +42,9 @@ export class GroupMembersComponent implements OnInit {
this._page.actionBar.title = 'Members of ' + this.group.Name;
});
let membersPrm = this._groupsService.getGroupMembers(this._groupId)
.then(members => this.members = members);
.then(members => this.members = members.sort((m1, m2) => {
return utilities.compareStringsForSort(m1.DisplayName, m2.DisplayName);
}));
Promise.all<any>([this._usersService.currentUser(), groupPrm, membersPrm])
.then((result) => {

Просмотреть файл

@ -8,6 +8,18 @@ export const dateFormat = 'MMM dd, yyyy, hh:mm a';
export const eventMandatoryFields = [ 'OrganizerId', 'LocationName', 'Name', 'GroupId' ];
export function compareStringsForSort (str1: string, str2: string) {
let result: number;
if (str1 < str2) {
result = -1;
} else if (str1 > str2) {
result = 1;
} else {
result = 0;
}
return result;
};
export function urlHasProtocol (str: string) {
let regExp = new RegExp('^[a-z]+://.+', 'i');
return regExp.test(str);