From ba67cf0a6731867854073710fbfe4c0c052bb9bc Mon Sep 17 00:00:00 2001 From: Just van den Broecke Date: Thu, 23 May 2013 14:46:55 +0200 Subject: [PATCH 1/2] fix for gxp #189 - allow matchCase in WFS Filter --- src/script/widgets/FilterBuilder.js | 10 +++++++++- src/script/widgets/QueryPanel.js | 11 +++++++++-- src/script/widgets/form/FilterField.js | 8 +++++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/script/widgets/FilterBuilder.js b/src/script/widgets/FilterBuilder.js index 1b48a2dc..c643186b 100644 --- a/src/script/widgets/FilterBuilder.js +++ b/src/script/widgets/FilterBuilder.js @@ -46,6 +46,12 @@ gxp.FilterBuilder = Ext.extend(Ext.Container, { */ allowBlank: false, + /** api: config[caseInsensitiveMatch] + * ``Boolean`` + * Should Comparison Filters for Strings do case insensitive matching? Default is ``"false"``. + */ + caseInsensitiveMatch: false, + /** api: config[preComboText] * ``String`` * String to display before filter type combo. Default is ``"Match"``. @@ -327,7 +333,8 @@ gxp.FilterBuilder = Ext.extend(Ext.Container, { }, createDefaultFilter: function() { - return new OpenLayers.Filter.Comparison(); + return new OpenLayers.Filter.Comparison({ + matchCase: !this.caseInsensitiveMatch}); }, /** private: method[wrapFilter] @@ -375,6 +382,7 @@ gxp.FilterBuilder = Ext.extend(Ext.Container, { attributes: this.attributes, allowBlank: group ? undefined : this.allowBlank, customizeFilterOnInit: group && false, + caseInsensitiveMatch: this.caseInsensitiveMatch, listeners: { change: function() { this.fireEvent("change", this); diff --git a/src/script/widgets/QueryPanel.js b/src/script/widgets/QueryPanel.js index f1714b33..4ff7eb07 100644 --- a/src/script/widgets/QueryPanel.js +++ b/src/script/widgets/QueryPanel.js @@ -70,7 +70,13 @@ gxp.QueryPanel = Ext.extend(Ext.Panel, { * Query by attributes. */ attributeQuery: true, - + + /** api: config[caseInsensitiveMatch] + * ``Boolean`` + * Should Comparison Filters for Strings do case insensitive matching? Default is ``"false"``. + */ + caseInsensitiveMatch: false, + /** private: property[selectedLayer] * ``Ext.data.Record`` * The currently selected record in the layers combo. @@ -292,7 +298,8 @@ gxp.QueryPanel = Ext.extend(Ext.Panel, { this.filterBuilder = new gxp.FilterBuilder({ //anchor: "-8px", attributes: this.attributeStore, - allowGroups: false + allowGroups: false, + caseInsensitiveMatch: this.caseInsensitiveMatch }); if(owner) { diff --git a/src/script/widgets/form/FilterField.js b/src/script/widgets/form/FilterField.js index 37b78657..1088265f 100644 --- a/src/script/widgets/form/FilterField.js +++ b/src/script/widgets/form/FilterField.js @@ -35,6 +35,12 @@ gxp.form.FilterField = Ext.extend(Ext.form.CompositeField, { */ upperBoundaryTip: "upper boundary", + /** api: config[caseInsensitiveMatch] + * ``Boolean`` + * Should Comparison Filters for Strings do case insensitive matching? Default is ``"false"``. + */ + caseInsensitiveMatch: false, + /** * Property: filter * {OpenLayers.Filter} Optional non-logical filter provided in the initial @@ -165,7 +171,7 @@ gxp.form.FilterField = Ext.extend(Ext.form.CompositeField, { * {OpenLayers.Filter} By default, returns a comarison filter. */ createDefaultFilter: function() { - return new OpenLayers.Filter.Comparison(); + return new OpenLayers.Filter.Comparison({matchCase: this.caseInsensitiveMatch}); }, /** From 0d1e37c10b370f33ad3da9be273ff25c3aebc35f Mon Sep 17 00:00:00 2001 From: Just van den Broecke Date: Sun, 26 May 2013 12:12:52 +0200 Subject: [PATCH 2/2] fix for gxp #189 - allow matchCase in WFS Filter - add missing negation --- src/script/widgets/form/FilterField.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/widgets/form/FilterField.js b/src/script/widgets/form/FilterField.js index 1088265f..f4c8bd1b 100644 --- a/src/script/widgets/form/FilterField.js +++ b/src/script/widgets/form/FilterField.js @@ -168,10 +168,10 @@ gxp.form.FilterField = Ext.extend(Ext.form.CompositeField, { * May be overridden to change the default filter. * * Returns: - * {OpenLayers.Filter} By default, returns a comarison filter. + * {OpenLayers.Filter} By default, returns a comparison filter. */ createDefaultFilter: function() { - return new OpenLayers.Filter.Comparison({matchCase: this.caseInsensitiveMatch}); + return new OpenLayers.Filter.Comparison({matchCase: !this.caseInsensitiveMatch}); }, /**