Improve sort button
This commit is contained in:
@@ -96,6 +96,6 @@
|
|||||||
<!-- Go to Top Button-->
|
<!-- Go to Top Button-->
|
||||||
<button type="button" class="btn btn-warning btn-top" [class.btn-top-is-visible]="atBottom"
|
<button type="button" class="btn btn-warning btn-top" [class.btn-top-is-visible]="atBottom"
|
||||||
aria-label="Top" (click)="scrollTop()">
|
aria-label="Top" (click)="scrollTop()">
|
||||||
<span class="glyphicon glyphicon-menu-up" style="color:white" aria-hidden="true"></span>
|
<span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -114,10 +114,10 @@
|
|||||||
<!-- Go to Top Button-->
|
<!-- Go to Top Button-->
|
||||||
<button type="button" class="btn btn-warning btn-top" [class.btn-top-is-visible]="atBottom"
|
<button type="button" class="btn btn-warning btn-top" [class.btn-top-is-visible]="atBottom"
|
||||||
aria-label="Top" (click)="scrollTop()">
|
aria-label="Top" (click)="scrollTop()">
|
||||||
<span class="glyphicon glyphicon-menu-up" style="color:white" aria-hidden="true"></span>
|
<span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-primary btn-top btn-sort" [class.btn-top-is-visible]="atBottom"
|
<button type="button" class="btn btn-primary btn-top btn-sort" [class.btn-top-is-visible]="sortable"
|
||||||
aria-label="Top" (click)="sort()">
|
aria-label="Top" (click)="sort()">
|
||||||
<span class="glyphicon glyphicon-sort-by-attributes" style="color:white" aria-hidden="true"></span>
|
<span class="glyphicon glyphicon-sort-by-attributes" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -24,8 +24,11 @@ export class ArtistComponent implements OnInit {
|
|||||||
artistName = "";
|
artistName = "";
|
||||||
songs: Array<Song> = [];
|
songs: Array<Song> = [];
|
||||||
artist: Artist = new Artist();
|
artist: Artist = new Artist();
|
||||||
|
// To activate button in interface var
|
||||||
moreDataAvailable: boolean = false;
|
moreDataAvailable: boolean = false;
|
||||||
atBottom: boolean = false;
|
atBottom: boolean = false;
|
||||||
|
sortable: boolean = false;
|
||||||
|
|
||||||
lockLoadData: boolean = true;
|
lockLoadData: boolean = true;
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
@@ -48,6 +51,7 @@ export class ArtistComponent implements OnInit {
|
|||||||
if (this.songs.length == 0) {
|
if (this.songs.length == 0) {
|
||||||
this.songs = data;
|
this.songs = data;
|
||||||
} else {
|
} else {
|
||||||
|
this.sortable = true;
|
||||||
data.forEach(song => {
|
data.forEach(song => {
|
||||||
this.songs.push(song);
|
this.songs.push(song);
|
||||||
});
|
});
|
||||||
@@ -86,5 +90,6 @@ export class ArtistComponent implements OnInit {
|
|||||||
|
|
||||||
sort(): void {
|
sort(): void {
|
||||||
this.songs = new SortPipe().transform(this.songs, 'Album', 'Track Number', 'Play Count');
|
this.songs = new SortPipe().transform(this.songs, 'Album', 'Track Number', 'Play Count');
|
||||||
|
this.sortable = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user