Open justb4 opened 11 years ago
There appeared an issue with multiple conditions in wrapWildCards when filter.filters was undefined. The fix is as follows (!typeof filter.filters === "undefined" line):
wrapWildCards: function (filter) {
if (filter instanceof OpenLayers.Filter.Logical) {
// JvdB: fix for Heron issue: 377
// https://code.google.com/p/geoext-viewer/issues/detail?id=377
// Fegyi's hack: check first if filter.filters is defined
if (!typeof filter.filters === "undefined") {
// Go recursively through composite filter
for (var i = 0; i < filter.filters.length; i++) {
filter = this.wrapWildCards(filter.filters[i]);
}
}
} else if (filter.type === OpenLayers.Filter.Comparison.LIKE) {
// Wrap the value in Wildcard strings.
filter.value = this.wildCardString + filter.value + this.wildCardString;
}
return filter;
},
I can make a patch and PR.
The QueryPanel/QueryFilter allows to attach explicit wildcard symbols (*) in the attribute query condition forms (for LIKE Comparison Filters with Strings). It would be handy to have a config property like 'autoWildCardAttach' that, when set to true, automatically wraps the string values of LIKE Comparison Filters with a wildcard. Together with caseInsensitiveMatch (see #189) this will provide a more modern form interaction.
This is similar to GeoExt.form (https://github.com/geoext/geoext/blob/master/lib/GeoExt/widgets/form.js), although with QueryPanel we may not need finegrained wildcard attachment control with STARTS_WITH, ENDS_WITH, CONTAINS, though this may be added later. For now CONTAINS-mode (prepend and append the wildcard) may be sufficient.
See an example here: http://lib.heron-mc.org/heron/latest/examples/querybuilder/ (try STATE_NAME like 'al').
This affects QueryBuilder.js and FilterBuilder.js (I don't think FilterField.js). I have a patch and can issue a pull.