diff --git a/src/app/awardee-list-table/awardee-list-table-datasource.ts b/src/app/awardee-list-table/awardee-list-table-datasource.ts index cd15457..9192d38 100644 --- a/src/app/awardee-list-table/awardee-list-table-datasource.ts +++ b/src/app/awardee-list-table/awardee-list-table-datasource.ts @@ -84,12 +84,13 @@ export class AwardeeListTableDataSource extends DataSource { 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); } diff --git a/src/app/awardee-list/awardee-list.component.ts b/src/app/awardee-list/awardee-list.component.ts index 26e4de0..008567d 100644 --- a/src/app/awardee-list/awardee-list.component.ts +++ b/src/app/awardee-list/awardee-list.component.ts @@ -23,7 +23,7 @@ export class AwardeeListComponent implements OnInit { this.route.data.subscribe((data: { awardees: Array, }) => { - this.awardeeService.awardees = data.awardees; + this.awardeeService.awardees = data.awardees.sort((a,b) => a.name.localeCompare(b.name, 'hu-HU')); }); } } diff --git a/src/app/judge-list-table/judge-list-table-datasource.ts b/src/app/judge-list-table/judge-list-table-datasource.ts index fca928d..b33308f 100644 --- a/src/app/judge-list-table/judge-list-table-datasource.ts +++ b/src/app/judge-list-table/judge-list-table-datasource.ts @@ -85,14 +85,14 @@ export class JudgeListTableDataSource extends DataSource { 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); } diff --git a/src/app/judge-list/judge-list.component.ts b/src/app/judge-list/judge-list.component.ts index d67dea6..2ca9015 100644 --- a/src/app/judge-list/judge-list.component.ts +++ b/src/app/judge-list/judge-list.component.ts @@ -23,7 +23,7 @@ export class JudgeListComponent implements OnInit { this.route.data.subscribe((data: { judges: Array, }) => { - this.judgeService.judges = data.judges; + this.judgeService.judges = data.judges.sort((a,b) => a.name.localeCompare(b.name, 'hu-HU')); }); } }