-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.component.ts
More file actions
40 lines (30 loc) · 1.15 KB
/
app.component.ts
File metadata and controls
40 lines (30 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Component, OnInit } from '@angular/core';
import { DataSource } from 'devextreme-angular/common/data';
import { Service, Employee, SearchExprItem } from './app.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
standalone: false,
})
export class AppComponent implements OnInit {
dataSource!: DataSource;
dropDownBoxDataSource!: DataSource;
displayExpr: ((item: any) => string) | undefined;
searchExprItems!: SearchExprItem[];
searchExprValue: string | string[] = 'Employee';
searchTimeout = 1000;
constructor(readonly service: Service) {}
ngOnInit(): void {
this.searchExprItems = this.service.getSearchExprItems();
this.dataSource = this.service.createTasksDataSource();
this.dropDownBoxDataSource = this.dataSource;
(this.service.lookupStore.load() as Promise<Employee[]>).then((items) => {
this.displayExpr = (item: any): string => this.service.getDisplayExpr(item, items);
return items;
}).catch((error) => {
// eslint-disable-next-line no-console
console.error('Failed to load lookup data:', error);
});
}
}