diff --git a/web/client/components/data/featuregrid/filterRenderers/AttributeFilter.jsx b/web/client/components/data/featuregrid/filterRenderers/AttributeFilter.jsx index b2149bc8a6..dc28a76310 100644 --- a/web/client/components/data/featuregrid/filterRenderers/AttributeFilter.jsx +++ b/web/client/components/data/featuregrid/filterRenderers/AttributeFilter.jsx @@ -50,7 +50,7 @@ class AttributeFilter extends React.PureComponent { booleanOperators: ["="], defaultOperators: ["=", ">", "<", ">=", "<=", "<>", "isNull"], timeDateOperators: ["=", ">", "<", ">=", "<=", "<>", "><", "isNull"], - operator: this.props.isWithinAttrTbl ? "=" : "", + operator: this.props.isWithinAttrTbl ? (this.props.operator || '=') : "", isInputValid: true }; } diff --git a/web/client/components/data/featuregrid/filterRenderers/StringFilter.jsx b/web/client/components/data/featuregrid/filterRenderers/StringFilter.jsx index adb13f44e3..4d781ef033 100644 --- a/web/client/components/data/featuregrid/filterRenderers/StringFilter.jsx +++ b/web/client/components/data/featuregrid/filterRenderers/StringFilter.jsx @@ -5,7 +5,8 @@ import { trim } from 'lodash'; export default compose( defaultProps({ onValueChange: () => {}, - placeholderMsgId: "featuregrid.filter.placeholders.string" + placeholderMsgId: "featuregrid.filter.placeholders.string", + operator: 'ilike' }), withHandlers({ onChange: props => ({value, attribute, inputOperator} = {}) => { diff --git a/web/client/components/data/featuregrid/filterRenderers/__tests__/StringFilter-test.jsx b/web/client/components/data/featuregrid/filterRenderers/__tests__/StringFilter-test.jsx index 2f9bf53922..c9da5b6256 100644 --- a/web/client/components/data/featuregrid/filterRenderers/__tests__/StringFilter-test.jsx +++ b/web/client/components/data/featuregrid/filterRenderers/__tests__/StringFilter-test.jsx @@ -35,6 +35,15 @@ describe('Test for StringFilter component', () => { expect(el).toExist(); expect(el.value).toBe("TEST"); }); + it('test the text field with the ilike default operator in attribute table', () => { + ReactDOM.render(, document.getElementById("container")); + const el = document.getElementsByClassName("form-control input-sm")[0]; + expect(el).toExist(); + expect(el.value).toBe("TEST"); + const operatorEl = document.querySelector('.rw-input'); + expect(operatorEl).toExist(); + expect(operatorEl.innerHTML).toEqual("ilike"); + }); it('Test StringFilter onChange', () => { const actions = { onChange: () => {}