@@ -5,6 +5,7 @@ import { BaseOptionsProvider } from "./BaseOptionsProvider";
55import { datasourceFilter } from "./datasourceFilter" ;
66import { CaptionsProvider , SortOrder , Status } from "./types" ;
77import { DEFAULT_LIMIT_SIZE } from "./utils" ;
8+ import { FilterCondition } from "mendix/filters" ;
89
910export interface BaseProps {
1011 attributeId ?: ListAttributeValue [ "id" ] ;
@@ -18,21 +19,22 @@ export class BaseDatasourceOptionsProvider extends BaseOptionsProvider<ObjectIte
1819 private ds ?: ListValue ;
1920 private attributeId ?: ListAttributeValue [ "id" ] ;
2021 protected loading : boolean = false ;
21- private debouncedSetFilter ? : ( filterCondition : any ) => void ;
22- private abortDebouncedFilter ? : ( ) => void ;
22+ private debouncedSetFilter ! : ( filterCondition : FilterCondition | undefined ) => void ;
23+ private abortDebouncedFilter ! : ( ) => void ;
2324 private filterInputDebounceInterval : number = 200 ;
2425
2526 constructor (
2627 caption : CaptionsProvider ,
2728 protected valuesMap : Map < string , ObjectItem >
2829 ) {
2930 super ( caption ) ;
31+ this . createDebouncedSetFilter ( ) ;
3032 }
3133
3234 private createDebouncedSetFilter ( ) : void {
3335 this . cleanup ( ) ;
3436
35- const [ debouncedFn , abort ] = debounce ( ( filterCondition : any ) => {
37+ const [ debouncedFn , abort ] = debounce ( ( filterCondition : FilterCondition | undefined ) => {
3638 this . ds ?. setFilter ( filterCondition ) ;
3739 } , this . filterInputDebounceInterval ) ;
3840
@@ -66,9 +68,6 @@ export class BaseDatasourceOptionsProvider extends BaseOptionsProvider<ObjectIte
6668
6769 getAll ( ) : string [ ] {
6870 if ( this . lazyLoading && this . attributeId ) {
69- if ( ! this . debouncedSetFilter ) {
70- this . createDebouncedSetFilter ( ) ;
71- }
7271 if ( this . searchTerm === "" ) {
7372 this . debouncedSetFilter ! ( undefined ) ;
7473 } else {
0 commit comments