Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am trying to place a combo-box in the top of my web application which will search an internal WFS from Geoserver. I am using the combo-box so I can have the "type ahead" functionality which I think will help then narrow down the site they are looking for. Then once I solve this issue I will have a listener which will get the info and zoom to the location on selection.

I am working of a test at then moment to see if I can implement it in an existing site, but I am running into some trouble. The combo-box doesn't filter the data store, it just returns a full list of the datastore regardless of what i type (see picture at bottom of post).

The code I have used is below, unfortunately I don't have an external facing site to show.

I originally was hoping to set my WFS output format to JSON and just load that into a JSON data store but I kept getting errors that I was unable to decipher.

Thanks

Ando

var queryLayer = "dam";
var protocol= OpenLayers.Protocol.WFS({
    url: "/geoserver/ows",
    featureType: queryLayer,
    featureNS: "www.awebsite.com.au", //Just for SE proper featureNS website used in application
    version: "1.0.0",
    srsName: "EPSG:4283"
});

var assetStore = new GeoExt.data.FeatureStore({
    fields: [
        {name: "name", type: "string"}
        //{name: "type", type: "string"}
    ],
    proxy: new GeoExt.data.ProtocolProxy({
            protocol: protocol              
        })
     });

new Ext.Viewport({
    layout: "border",
    items: [{
        region: "center",
        id: "mappanel",
        //title: "Map",
        xtype: "gx_mappanel",
        map: map,
        tbar:['->',{
                xtype: 'combo',
                fieldLabel: 'Search for an asset:',
                store: assetStore,
                displayField: 'name',
                forceSelection: true,
                triggerAction: 'all',
                minChars: 1,
                displayField: 'name'                                                            
        }],
        layers: [layer],
        extent: extent,
        split: true
    }]
});

enter image description here

Edit This is the query that is getting sent to the server, its not passing the name from the combo box to the query so I assume that why everything is being returned. Is there a configOption I am missing here??

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><wfs:Query typeName="feature:dam" xmlns:feature="www.mywebsite.com.au"/></wfs:GetFeature>
share|improve this question

closed as off-topic by blah238, Fezter, whuber Jul 24 '13 at 2:20

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about software development are off-topic here unless they relate directly to Geographical Information Systems, but they can be asked on Stack Overflow." – blah238, Fezter, whuber
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Since this is more of an ExtJS question, you might have better luck with it on stackoverflow.com. –  Michael Todd Dec 10 '11 at 18:30

5 Answers 5

Had the same problem today! Remove the

 triggerAction: 'all',

option and it will work. triggerAction in fact tells the combox to always display all of its values regardless of filters.

Documentation is scarce, but this thread describes the possible values for triggerAction:

http://www.sencha.com/forum/showthread.php?40428-combo-box-triggerAction

share|improve this answer
    
I tried your suggestion with no luck unfortunately. I attached to my original post the request getting sent to the server, and it appears that the name in the combo box is not being included in the <wfs:query> request. Not to sure why, been googling with no avail - I may ditch the combo box and just have a text field search. –  Ando Dec 16 '11 at 22:45

In your combobox you only appeaar to be setting a displayField and not a valueField - the actual value that is selected when an item is selected. Try:

   {
            xtype: 'combo',
            fieldLabel: 'Search for an asset:',
            store: assetStore,
            displayField: 'name',
            forceSelection: true,
            triggerAction: 'all',
            minChars: 1,
            displayField: 'name',
            valueField: 'name'                                                      
    }
share|improve this answer

You should try that config option:

typeAhead: true

See: documentation

share|improve this answer
    
I put that configuration option in, same results. –  Ando Dec 8 '11 at 19:47

I had the same problem caused by running clearFilter on the store e.g: assetStore.clearFilter();

Remove this from your code, it's not needed in ext4.

share|improve this answer

Add this to the combo box config:

mode:"local"

.....

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.