mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Adding focus to the input after the reset button is clicked
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div class="treeview-header row mb-1">
|
||||
<div class="col-12">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" [(ngModel)]="searchText" (keyup.enter)="search()"
|
||||
<input #searchInput type="text" class="form-control" [(ngModel)]="searchText" (keyup.enter)="search()"
|
||||
[attr.aria-label]="'vocabulary-treeview.search.form.search-placeholder' | translate"
|
||||
[placeholder]="'vocabulary-treeview.search.form.search-placeholder' | translate">
|
||||
<div class="input-group-append" id="button-addon4">
|
||||
|
@@ -8,6 +8,7 @@ import {
|
||||
} from '@angular/common';
|
||||
import {
|
||||
Component,
|
||||
ElementRef,
|
||||
EventEmitter,
|
||||
Input,
|
||||
OnChanges,
|
||||
@@ -15,6 +16,7 @@ import {
|
||||
OnInit,
|
||||
Output,
|
||||
SimpleChanges,
|
||||
ViewChild,
|
||||
} from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
@@ -70,6 +72,11 @@ export type VocabularyTreeItemType = FormFieldMetadataValueObject | VocabularyEn
|
||||
})
|
||||
export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges {
|
||||
|
||||
/**
|
||||
* Implemented to manage focus on input
|
||||
*/
|
||||
@ViewChild('searchInput') searchInput: ElementRef;
|
||||
|
||||
/**
|
||||
* The {@link VocabularyOptions} object
|
||||
*/
|
||||
@@ -332,6 +339,7 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges
|
||||
this.storedNodeMap = new Map<string, TreeviewFlatNode>();
|
||||
this.vocabularyTreeviewService.restoreNodes();
|
||||
}
|
||||
this.searchInput.nativeElement.focus();
|
||||
}
|
||||
|
||||
add() {
|
||||
|
Reference in New Issue
Block a user