Mark selected row as active

This commit is contained in:
Geomitron
2020-05-28 18:20:58 -04:00
parent 19faaffb27
commit 58a0116662
3 changed files with 5 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "bridge", "name": "bridge",
"version": "0.0.0", "version": "0.0.1",
"description": "A Clone Hero library management tool with built in chart searching and downloading.", "description": "A Clone Hero library management tool with built in chart searching and downloading.",
"homepage": "https://github.com/Geomitron/Bridge", "homepage": "https://github.com/Geomitron/Bridge",
"license": "GPL-3.0", "license": "GPL-3.0",

View File

@@ -22,6 +22,7 @@
#tableRow #tableRow
*ngFor="let result of results" *ngFor="let result of results"
(click)="onRowClicked(result)" (click)="onRowClicked(result)"
[class.active]="activeRowID == result.id"
[result]="result"></tr> [result]="result"></tr>
</tbody> </tbody>
</table> </table>

View File

@@ -18,6 +18,7 @@ export class ResultTableComponent implements OnInit {
@ViewChildren('tableRow') tableRows: QueryList<ResultTableRowComponent> @ViewChildren('tableRow') tableRows: QueryList<ResultTableRowComponent>
results: SongResult[] results: SongResult[]
activeRowID: number = null
constructor(private searchService: SearchService, private selectionService: SelectionService) { } constructor(private searchService: SearchService, private selectionService: SelectionService) { }
@@ -27,11 +28,13 @@ export class ResultTableComponent implements OnInit {
}) })
this.searchService.onSearchChanged(results => { this.searchService.onSearchChanged(results => {
this.activeRowID = null
this.results = results this.results = results
}) })
} }
onRowClicked(result: SongResult) { onRowClicked(result: SongResult) {
this.activeRowID = result.id
this.rowClicked.emit(result) this.rowClicked.emit(result)
} }