[Users] Combination of FeatueStore with FormPanel

Daniel Kastl orkney at gmx.de
Fri May 22 06:12:52 CEST 2009


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()],
		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'
		})
	})
});

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 here
			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?
How do I update my vector layer features and grid according to what the 
query returns me?

Is there an elegant way with GeoExt?
Otherwise could you just give some keywords so I know what I can search for.

Daniel



More information about the Users mailing list