* 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[]) {
|
private getFilteredData(data: Awardee[]) {
|
||||||
return this.filter
|
return this.filter
|
||||||
? data.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;
|
: data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Simple sort comparator for example ID/Name columns (for client-side sorting). */
|
/** Simple sort comparator for example ID/Name columns (for client-side sorting). */
|
||||||
function compare(a, b, isAsc) {
|
function compare(a: string, b: string, isAsc) {
|
||||||
return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
|
return a.localeCompare(b, 'hu-HU') * (isAsc ? 1 : -1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export class AwardeeListComponent implements OnInit {
|
|||||||
this.route.data.subscribe((data: {
|
this.route.data.subscribe((data: {
|
||||||
awardees: Array<Awardee>,
|
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
|
return this.filter
|
||||||
? data.filter(
|
? data.filter(
|
||||||
row => row.name.toLocaleLowerCase().indexOf(this.filter) > -1
|
row => row.name.toLocaleLowerCase().indexOf(this.filter) > -1
|
||||||
|| row.titles.some(
|
|| row.titles.some(title => title.year.toString().startsWith(this.filter))
|
||||||
title => title.year.toString().startsWith(this.filter)
|
|| row.titles.some(title => title.title.toLocaleLowerCase().indexOf(this.filter) > -1)
|
||||||
))
|
)
|
||||||
: data;
|
: data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Simple sort comparator for example ID/Name columns (for client-side sorting). */
|
/** Simple sort comparator for example ID/Name columns (for client-side sorting). */
|
||||||
function compare(a, b, isAsc) {
|
function compare(a: string, b: string, isAsc) {
|
||||||
return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
|
return a.localeCompare(b, 'hu-HU') * (isAsc ? 1 : -1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export class JudgeListComponent implements OnInit {
|
|||||||
this.route.data.subscribe((data: {
|
this.route.data.subscribe((data: {
|
||||||
judges: Array<Judge>,
|
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