From b8fb2df231a1e31b7c43d43ba0116c14bf93199b Mon Sep 17 00:00:00 2001 From: Gareth Smith Date: Tue, 1 Mar 2016 10:12:26 +0000 Subject: [PATCH 1/4] Allow IFilterOptions.condition to be set to a function, as the documentation describes. --- ui-grid/ui-grid-tests.ts | 3 +++ ui-grid/ui-grid.d.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ui-grid/ui-grid-tests.ts b/ui-grid/ui-grid-tests.ts index e89f180b9..5376e6aaa 100644 --- a/ui-grid/ui-grid-tests.ts +++ b/ui-grid/ui-grid-tests.ts @@ -41,6 +41,9 @@ columnDef.filter = { selectOptions: [{value: 4, label: 'test'}], disableCancelButton: false }; +columnDef.filter.condition = (searchTerm:string, cellValue:any, row:uiGrid.IGridRow, column:uiGrid.IGridColumn):boolean => { + return true; +}; columnDef.filterCellFiltered = false; columnDef.filterHeaderTemplate = '
'; columnDef.filters = [columnDef.filter]; diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index bd0ecd835..11786da15 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -3844,7 +3844,7 @@ declare module uiGrid { * or you can supply a custom filter function that gets passed the * following arguments: [searchTerm, cellValue, row, column]. */ - condition?: number; + condition?: number | ((searchTerm:string, cellValue:any, row:IGridRow, column:IGridColumn) => boolean); /** * If set, the filter field will be pre-populated with this value */ From c947dac0f14dc9815cb1e9a3bf6f3d1900106694 Mon Sep 17 00:00:00 2001 From: Gareth Smith Date: Thu, 3 Mar 2016 10:48:42 +0000 Subject: [PATCH 2/4] Add spaces for consistency as requested by @btesser-r7 --- ui-grid/ui-grid-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-grid/ui-grid-tests.ts b/ui-grid/ui-grid-tests.ts index 5376e6aaa..a4ff0ed00 100644 --- a/ui-grid/ui-grid-tests.ts +++ b/ui-grid/ui-grid-tests.ts @@ -41,7 +41,7 @@ columnDef.filter = { selectOptions: [{value: 4, label: 'test'}], disableCancelButton: false }; -columnDef.filter.condition = (searchTerm:string, cellValue:any, row:uiGrid.IGridRow, column:uiGrid.IGridColumn):boolean => { +columnDef.filter.condition = (searchTerm: string, cellValue: any, row: uiGrid.IGridRow, column: uiGrid.IGridColumn): boolean => { return true; }; columnDef.filterCellFiltered = false; From d84f058588d9412bd5d450d99fdab108c3a9f5ec Mon Sep 17 00:00:00 2001 From: Gareth Smith Date: Thu, 3 Mar 2016 10:51:00 +0000 Subject: [PATCH 3/4] Add spaces and remove parenthesis as requested by @btesser-r7 --- ui-grid/ui-grid.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 11786da15..d001cf9f0 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -3844,7 +3844,7 @@ declare module uiGrid { * or you can supply a custom filter function that gets passed the * following arguments: [searchTerm, cellValue, row, column]. */ - condition?: number | ((searchTerm:string, cellValue:any, row:IGridRow, column:IGridColumn) => boolean); + condition?: number | (searchTerm: string, cellValue: any, row: IGridRow, column: IGridColumn) => boolean; /** * If set, the filter field will be pre-populated with this value */ From 05a7814474bb7f8209c3a8130f3e02a881308e03 Mon Sep 17 00:00:00 2001 From: Dretch Date: Thu, 3 Mar 2016 10:57:10 +0000 Subject: [PATCH 4/4] Restore not-actually-extraneous parenthesis --- ui-grid/ui-grid.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index d001cf9f0..34cc1c98e 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -3844,7 +3844,7 @@ declare module uiGrid { * or you can supply a custom filter function that gets passed the * following arguments: [searchTerm, cellValue, row, column]. */ - condition?: number | (searchTerm: string, cellValue: any, row: IGridRow, column: IGridColumn) => boolean; + condition?: number | ((searchTerm: string, cellValue: any, row: IGridRow, column: IGridColumn) => boolean); /** * If set, the filter field will be pre-populated with this value */