* locale based sorting implemented
* judge filter in admin now filters in titles aswell
This commit is contained in:
parent
3db94030bd
commit
13af48efbd
@ -84,12 +84,13 @@ export class AwardeeListTableDataSource extends DataSource<Awardee> {
|
||||
private getFilteredData(data: Awardee[]) {
|
||||
return this.filter
|
||||
? data.filter(
|
||||
row => row.name.toLocaleLowerCase().indexOf(this.filter) > -1 || row.year.toString().startsWith(this.filter))
|
||||
row => row.name.toLocaleLowerCase().indexOf(this.filter) > -1
|
||||
|| row.year.toString().startsWith(this.filter))
|
||||
: data;
|
||||
}
|
||||
}
|
||||
|
||||
/** Simple sort comparator for example ID/Name columns (for client-side sorting). */
|
||||
function compare(a, b, isAsc) {
|
||||
return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
|
||||
function compare(a: string, b: string, isAsc) {
|
||||
return a.localeCompare(b, 'hu-HU') * (isAsc ? 1 : -1);
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ export class AwardeeListComponent implements OnInit {
|
||||
this.route.data.subscribe((data: {
|
||||
awardees: Array<Awardee>,
|
||||
}) => {
|
||||
this.awardeeService.awardees = data.awardees;
|
||||
this.awardeeService.awardees = data.awardees.sort((a,b) => a.name.localeCompare(b.name, 'hu-HU'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,14 +85,14 @@ export class JudgeListTableDataSource extends DataSource<Judge> {
|
||||
return this.filter
|
||||
? data.filter(
|
||||
row => row.name.toLocaleLowerCase().indexOf(this.filter) > -1
|
||||
|| row.titles.some(
|
||||
title => title.year.toString().startsWith(this.filter)
|
||||
))
|
||||
|| row.titles.some(title => title.year.toString().startsWith(this.filter))
|
||||
|| row.titles.some(title => title.title.toLocaleLowerCase().indexOf(this.filter) > -1)
|
||||
)
|
||||
: data;
|
||||
}
|
||||
}
|
||||
|
||||
/** Simple sort comparator for example ID/Name columns (for client-side sorting). */
|
||||
function compare(a, b, isAsc) {
|
||||
return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
|
||||
function compare(a: string, b: string, isAsc) {
|
||||
return a.localeCompare(b, 'hu-HU') * (isAsc ? 1 : -1);
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ export class JudgeListComponent implements OnInit {
|
||||
this.route.data.subscribe((data: {
|
||||
judges: Array<Judge>,
|
||||
}) => {
|
||||
this.judgeService.judges = data.judges;
|
||||
this.judgeService.judges = data.judges.sort((a,b) => a.name.localeCompare(b.name, 'hu-HU'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user