From 0e97a1addb289c50e5c7687b1b24e13159b05473 Mon Sep 17 00:00:00 2001 From: Vildan Softic Date: Thu, 18 Jul 2024 10:48:26 +0200 Subject: [PATCH] fix: provide all search values --- examples/vite-demo-vanilla-bundle/src/examples/example09.ts | 4 ++-- .../common/src/interfaces/backendServiceOption.interface.ts | 2 +- packages/odata/src/services/grid-odata.service.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/vite-demo-vanilla-bundle/src/examples/example09.ts b/examples/vite-demo-vanilla-bundle/src/examples/example09.ts index 801093264..ea6930db9 100644 --- a/examples/vite-demo-vanilla-bundle/src/examples/example09.ts +++ b/examples/vite-demo-vanilla-bundle/src/examples/example09.ts @@ -145,9 +145,9 @@ export default class Example09 { enableCount: this.isCountEnabled, // add the count in the OData query, which will return a property named "__count" (v2) or "@odata.count" (v4) enableSelect: this.isSelectEnabled, enableExpand: this.isExpandEnabled, - filterQueryOverride: ({ fieldName, columnDef, columnFilterOperator, searchValue }) => { + filterQueryOverride: ({ fieldName, columnDef, columnFilterOperator, searchValues }) => { if (columnFilterOperator === OperatorType.custom && columnDef?.id === 'name') { - let matchesSearch = (searchValue as string).replace(/\*/g, '.*'); + let matchesSearch = searchValues[0].replace(/\*/g, '.*'); matchesSearch = matchesSearch.slice(0, 1) + CARET_HTML_ESCAPED + matchesSearch.slice(1); matchesSearch = matchesSearch.slice(0, -1) + '$\''; diff --git a/packages/common/src/interfaces/backendServiceOption.interface.ts b/packages/common/src/interfaces/backendServiceOption.interface.ts index 52458bb15..b100584da 100644 --- a/packages/common/src/interfaces/backendServiceOption.interface.ts +++ b/packages/common/src/interfaces/backendServiceOption.interface.ts @@ -26,7 +26,7 @@ export interface BackendServiceFilterQueryOverrideArgs { /** The inferred operator. See columnDef.autoParseInputFilterOperator */ operator: OperatorType; /** The entered search value */ - searchValue: any; + searchValues: any[]; /** A reference to the SlickGrid instance */ grid: SlickGrid | undefined } \ No newline at end of file diff --git a/packages/odata/src/services/grid-odata.service.ts b/packages/odata/src/services/grid-odata.service.ts index 8af92796c..935f51e25 100644 --- a/packages/odata/src/services/grid-odata.service.ts +++ b/packages/odata/src/services/grid-odata.service.ts @@ -433,7 +433,7 @@ export class GridOdataService implements BackendService { columnDef, operator, columnFilterOperator: columnFilter.operator, - searchValue, + searchValues: searchTerms, grid: this._grid }); }