smas1 / geoext-viewer

Automatically exported from code.google.com/p/geoext-viewer
GNU General Public License v3.0
0 stars 0 forks source link

querybuilder fails with multiple attribute conditions #377

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open example querybuilder
2. Add condition NAME10 = Colorado
3. Click on search
Result is okay
4. Go back to Search
5. Press Add condition
6. Select condition STUSPS10 = CO
7. Click on Search

A javascript error is shown in the console:
Uncaught TypeError: Cannot read property '1' of undefined 

Original issue reported on code.google.com by Martijn....@gmail.com on 23 May 2014 at 9:15

GoogleCodeExporter commented 9 years ago

Original comment by jus...@gmail.com on 23 May 2014 at 2:01

GoogleCodeExporter commented 9 years ago
From Gergely: " ... had the same problem before. Unfortunately you have to hack 
into the code.
You should find the following class: QueryPanel.js

Change the following method:
    wrapWildCards: function (filter) {
        if (filter instanceof OpenLayers.Filter.Logical) {
            // Go recursively through composite filter
            for (var i = 0, len = filter.filters.length; i < len; ++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;
    },

to this:
    wrapWildCards: function (filter) {
        if (filter instanceof OpenLayers.Filter.Logical) {
                //Fegyi's hack
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;
    },

And after that, into your html after adding gxp.js, add the modified 
QueryPanel.js as well."

Original comment by jus...@gmail.com on 23 May 2014 at 2:17

GoogleCodeExporter commented 9 years ago
Fixed and verified in GXP, see example
http://lib.heron-mc.org/heron/latest/examples/querybuilder/

Many thanks to Gergely !

We will try to backport to GXP, via 
https://github.com/boundlessgeo/gxp/issues/191 but the ux/gxp in Heron at least 
is fixed.

Original comment by jus...@gmail.com on 23 May 2014 at 2:57