[Users] Combination of FeatueStore with FormPanel

Eric Lemoine eric.lemoine at camptocamp.com
Fri May 22 18:30:49 CEST 2009


On Friday, May 22, 2009, Daniel Kastl <orkney at gmx.de> wrote:
> Hi list,
>
> I have a FeatureStore and it works pretty good:
>
> var helicopters = new OpenLayers.Layer.Vector('Helicopters',{});
>
> var heliStore = new GeoExt.data.FeatureStore({
>         layer: helicopters,
>         fields: [{
>                 name: 'heliid', type: 'string'
>         },{
>                 name: 'altitude', type: 'float'
>         },{
>                 name: 'speed', type: 'float'
>         }],
>         proxy: new GeoExt.data.ProtocolProxy({
>                 strategies: [new OpenLayers.Strategy.BBOX()],

You cannot configure strategies in protocol proxy.

>                 protocol: new OpenLayers.Protocol.WFS({
>                         url: 'http://localhost/geoserver/wfs',
>                         featureNS: 'http://www.openplans.org/spearfish',
>                         featurePrefix: 'rajicon',
>                         featureType: 'wfs_helicopters',
>                         srsName: 'EPSG:54004',
>                         version: '1.1.0'
>                 })
>         })
> });

I don't understand why you use a protocol proxy here.

>
> Then I have a FormPanel and it also works:
>
> var heliform = new GeoExt.form.FormPanel({
>         title: 'Search Helicpters',
>         xtype: 'form',
>         protocol: heliStore.proxy.protocol,
>         items : [{
>                 xtype : 'fieldset',
>                 title : 'Fleet',
>                 items : [{
>                         xtype : 'combo',
>                         fieldLabel : 'Fleet Name',
>                         name : 'fleet__like',
>                         store: fleetStore, // Defined somewhere before
>                         displayField: 'name',
>                         mode: 'local',
>                         emptyText: 'Select a fleet...'
>                 }]
>         }],
>         listeners: {
>                 actioncomplete: function(form, action) {
>                         // I can see the results herel
>                         console.info(action);
>                 }
>         }
> });
>
> heliform.addButton({
>         text: 'Find',
>         handler: function() { this.search(); },
>         scope: heliform
> });
>
> My question is how to synchronize the FeatureStore (Vector layer + ExtJS
> grid) with my search result?

In the actioncomplete listener you can do either
featuteStore.loadData(features) or vectorLayer.addFeatures(features).
Both should have the same effect since the store and the layer are
synchonized.


> How do I update my vector layer features and grid according to what the
> query returns me?

The above answer should answer this one as well.

>
> Is there an elegant way with GeoExt?

Hope the above is elegant enough to you ;-)

So I don't think you need a protocol proxy. I think you just need a
form panel configured with a protocol, and a feature store bound to a
layer.

> Otherwise could you just give some keywords so I know what I can search for.

Hope this helps,



>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Users mailing list