Skip to content

Commit 1c01e74

Browse files
authored
Merge pull request #5593 from StrangelyTyped/filter-raw-term
feat(filter): Add rawTerm option to columnDef filter options
2 parents 4e395f6 + a75e65a commit 1c01e74

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/js/core/factories/GridColumn.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,8 @@ angular.module('ui.grid')
740740
* - ariaLabel: String that will be set to the `<input>.ariaLabel` attribute. This is what is read as a label to screen reader users.
741741
* - noTerm: set this to true if you have defined a custom function in condition, and
742742
* your custom function doesn't require a term (so it can run even when the term is null)
743+
* - rawTerm: set this to true if you have defined a custom function in condition, and
744+
* your custom function requires access to the raw unmodified search term that was entered
743745
* - flags: only flag currently available is `caseSensitive`, set to false if you don't want
744746
* case sensitive matching
745747
* - type: defaults to {@link ui.grid.service:uiGridConstants#properties_filter uiGridConstants.filter.INPUT},

src/js/core/services/rowSearcher.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@ module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil
125125

126126
if ( !gridUtil.isNullOrUndefined(filter.term) ){
127127
// it is possible to have noTerm.
128-
newFilter.term = rowSearcher.stripTerm(filter);
128+
if ( filter.rawTerm ){
129+
newFilter.term = filter.term;
130+
} else {
131+
newFilter.term = rowSearcher.stripTerm(filter);
132+
}
129133
}
130134
newFilter.noTerm = filter.noTerm;
131135

0 commit comments

Comments
 (0)