Compare commits
3 Commits
7239995ce3
...
1e83e0c8a8
Author | SHA1 | Date |
---|---|---|
Florian Hartwich | 1e83e0c8a8 | |
Florian Hartwich | a18bedbc48 | |
Florian Hartwich | 2daefe0e6c |
|
@ -3,7 +3,7 @@
|
|||
|
||||
<div class="input-group search-field">
|
||||
<input id="search-tasks"
|
||||
placeholder="Spielername"
|
||||
placeholder="Spielername (mehrere mit '&' trennen)"
|
||||
type="text" #query class="form-control"
|
||||
(keyup.enter)="filterPlayers()"
|
||||
[formControl]="searchTerm">
|
||||
|
@ -58,6 +58,7 @@
|
|||
</ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="valueColWidth" name="Tode" prop="death"></ngx-datatable-column>
|
||||
</ngx-datatable>
|
||||
|
||||
<ngx-datatable
|
||||
[rows]="players.respawn"
|
||||
[reorderable]="reorderable"
|
||||
|
|
|
@ -4,6 +4,7 @@ import {PlayerService} from "../../services/logs/player.service";
|
|||
import {CampaignService} from "../../services/logs/campaign.service";
|
||||
import {Fraction} from "../../utils/fraction.enum";
|
||||
import {FormControl} from "@angular/forms";
|
||||
import {Observable} from "rxjs/Observable";
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -61,6 +62,12 @@ export class StatisticHighScoreComponent {
|
|||
})
|
||||
}
|
||||
});
|
||||
|
||||
const searchTermStream = this.searchTerm.valueChanges.debounceTime(400);
|
||||
|
||||
Observable.merge(searchTermStream)
|
||||
.distinctUntilChanged().map(query => this.filterPlayers())
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
initData() {
|
||||
|
@ -89,8 +96,16 @@ export class StatisticHighScoreComponent {
|
|||
}
|
||||
|
||||
private filterPlayerAttribute(attribute) {
|
||||
const query = this.searchTerm.value.toLowerCase();
|
||||
return this.playersStored[attribute].filter(p => p.name.toLowerCase().includes(query))
|
||||
const query = this.searchTerm.value.toLowerCase().split('&');
|
||||
|
||||
return this.playersStored[attribute].filter(player => {
|
||||
for (let i = 0; i < query.length; i++) {
|
||||
if (player.name.toLowerCase().includes(query[i].trim())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ ngx-datatable {
|
|||
}
|
||||
|
||||
:host /deep/ .ngx-datatable.scroll-vertical .datatable-body::-webkit-scrollbar-track {
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
|
@ -57,11 +57,9 @@ ngx-datatable {
|
|||
background: #4b4b4b;
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
/* Table Scrollbar END */
|
||||
|
||||
|
||||
|
||||
|
||||
.in-table-btn {
|
||||
position: absolute;
|
||||
margin-top: -5px;
|
||||
|
|
Loading…
Reference in New Issue