[Users] Geoext search?

Bart van den Eijnden bartvde at osgis.nl
Sun Feb 14 17:19:01 CET 2010


Hi Zoran,

basically it just uses WFS Web Feature Service under the hood. So you need to understand that protocol.

If you have your geoserver running, try and do a GetFeature request with maxfeatures 10 on your layer/featuretype to ensure things are properly working on that side, so e.g.

http://foo/geoserver?service=WFS&request=GetFeature&typename=xxx&maxfeatures=10&version=1.1.0

After that configure your OpenLayers protocol which will be used by GeoExt search components.

Also, if you have not already done so, install Firebug to see the request response cycle.

Best regards,
Bart

On Feb 14, 2010, at 5:13 PM, Zoran Jankovic wrote:

> 
> 
> 
> On Sun, Feb 14, 2010 at 4:56 PM, Bart van den Eijnden <bartvde at osgis.nl> wrote:
> Hi Zoran,
> 
> ok, I see now, indeed you need to use Ext.form.FormPanel, ignore my previous post about that.
> 
> The other problem you reported (ct is undefined), is because you are running your javascript code before the DOM is ready, and your div is simply not yet there. So use Ext.onReady instead to wrap your code, something like:
> 
> Ext.onReady(
> function() {
>         var formPanel = new Ext.form.FormPanel({
>     renderTo: "formpanel",
>     items: [{
>         xtype: "textfield",
>         name: "name__like",
>         value: "mont"
>     }, {
>         xtype: "textfield",
>         name: "elevation__ge",
>         value: "2000"
>     }]
> });
> 
> var searchAction = new GeoExt.form.SearchAction(formPanel.getForm(), {
>     protocol: new OpenLayers.Protocol.WFS({
>         url: "http://publicus.opengeo.org/geoserver/wfs",
>         featureType: "tasmania_roads",
>         featureNS: "http://www.openplans.org/topp"
>     }),
>     abortPrevious: true
> });
> 
> formPanel.getForm().doAction(searchAction, {
>     callback: function(response) {
>         // response.features includes the features read
>         // from the server through the protocol
>     }
> });
> 
> });
> 
> Best regards,
> Bart
> 
> 
> OK, now we are getting somewhere :-). Finally I have something rendered in my DIV, although it's just two text fields, now at least I'm making some progress...
> Is there _anywhere_ a working example of this Search action? As I in a previous post, I have SHP as a layer in Geoserver, and I need to search through "names" attribute and display the result...
> I found Geonames example, but it's a definitive overkill for my needs, at least for now, and at this stadia of JS knowledge ;-).
> 
> BTW, that link "Test it!" under geoext.blogspot.com (UX introduction) is also broken:
> http://dev.geoext.org/ux/GeoNamesSearchCombo/examples/GeoNamesSearchComboExample.html
> 
> Previous link will get you nowhere, you have to start from  http://dev.geoext.org/ux and work your way through to find this example:
> http://dev.geoext.org/ux/geoext.ux/ux/GeoNamesSearchCombo/examples/GeoNamesSearchComboExample.html
> 
> BR,
> 
>  
> --- 
> Zoran Jankovic
> ZIS-Izrada softvera i savjetovanje / ZIS - Software Development and Consulting
> 
> http://www.zisis.hr
> 
> M: 00 385 98 682 902
> T:  00 385 44 683 374
> 
> A. Senoe 4
> 44320 Kutina
> Croatia

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100214/e7543133/attachment-0001.htm 


More information about the Users mailing list