mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +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">
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { FlatTreeControl } from '@angular/cdk/tree';
|
||||
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { Component, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output, OnChanges, SimpleChanges, ViewChild } from '@angular/core';
|
||||
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { Store } from '@ngrx/store';
|
||||
@@ -29,6 +29,11 @@ import { AlertType } from '../../alert/alert-type';
|
||||
})
|
||||
export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges {
|
||||
|
||||
/**
|
||||
* Implemented to manage focus on input
|
||||
*/
|
||||
@ViewChild('searchInput') searchInput: ElementRef;
|
||||
|
||||
/**
|
||||
* The {@link VocabularyOptions} object
|
||||
*/
|
||||
@@ -294,6 +299,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