TSK-474 Change classification searcher input style and collapse tree after remove filter

This commit is contained in:
Martin Rojas Miguel Angel 2018-05-02 10:35:26 +02:00 committed by Mustapha Zorgati
parent 4450002a81
commit 3545df7448
2 changed files with 11 additions and 3 deletions

View File

@ -16,7 +16,8 @@
}
input.filter-input {
margin: 10px 0px;
margin: 10px 2px;
height: 32px;
width: 100%;
padding-left: 10px;
}

View File

@ -22,6 +22,7 @@ export class TaskanaTreeComponent implements OnInit, AfterViewChecked {
@Input() filterText: string;
private filterTextOld: string
private beforeFilteringState: ITreeState;
options: ITreeOptions = {
displayField: 'name',
@ -59,7 +60,8 @@ export class TaskanaTreeComponent implements OnInit, AfterViewChecked {
}
if (this.filterTextOld !== this.filterText) {
this.filterTextOld = this.filterText;
this.filterNodes(this.filterText)
this.filterNodes(this.filterText);
this.manageTreeState();
}
}
@ -102,9 +104,14 @@ export class TaskanaTreeComponent implements OnInit, AfterViewChecked {
private filterNodes(text) {
this.tree.treeModel.filterNodes((node) => {
return (node.data.name.toUpperCase().includes(text.toUpperCase())
|| node.data.key.toUpperCase().includes(text.toUpperCase()));
|| node.data.key.toUpperCase().includes(text.toUpperCase()));
});
}
private manageTreeState() {
if (this.filterText === '') {
this.tree.treeModel.collapseAll();
}
}
}