Merge pull request #4829 from tsiegleauq/id-in-sort

Use ID in search value and sort view
This commit is contained in:
Emanuel Schütze 2019-07-08 19:52:47 +02:00 committed by GitHub
commit 2f2e415b78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View File

@ -133,13 +133,25 @@ export class SearchValueSelectorComponent implements OnDestroy {
*/
public getFilteredItems(): Selectable[] {
if (this.selectableItems) {
return this.selectableItems.filter(
item =>
return this.selectableItems.filter(item => {
const idString = '' + item.id;
const foundId =
idString
.trim()
.toLowerCase()
.indexOf(this.searchValue) !== -1;
if (foundId) {
return true;
}
return (
item
.toString()
.toLowerCase()
.indexOf(this.searchValue) > -1
);
);
});
}
}

View File

@ -19,6 +19,9 @@
</div>
<div class="section-three">
<!-- Extra controls slot using implicit template references -->
<mat-basic-chip class="bluegrey" disableRipple matTooltip="{{ 'Sequantial number' | translate }}">
{{ item.id }}
</mat-basic-chip>
<ng-template [ngTemplateOutlet]="templateRef" [ngTemplateOutletContext]="{ $implicit: item }"></ng-template>
</div>
<div class="line" *cdkDragPreview>