[Users] Search functionality with GeoExt but without Mapfish
Matt Priour
mpriour at kestrelcomputer.com
Tue Nov 2 14:47:36 CET 2010
I have a WFSSearchForm that I built that I thought would be a good fit, but looking into it, I see that there are a lot of specific assumptions and simplifications that essentially recreates the logic of the GeoExt.form.FormPanel but in a much less flexible way. So I would instead suggest a panel which combines a GeoExt.form.FormPanel and a feature grid.
The following code is combined from the GeoExt examples but is untested
...
var vecLayer = new OpenLayers.Layer.Vector('myVectorLayer');
var store,gridPanel,formPanel,mainPanel
// create feature store, binding it to the vector layer
store = new GeoExt.data.FeatureStore({
layer: vecLayer,
fields: [
{name: 'name', type: 'string'},
{name: 'elevation', type: 'float'}
],
proxy: new GeoExt.data.ProtocolProxy({
protocol: new OpenLayers.Protocol.WFS({
url: "http://my.wfs",
outputFormat: new OpenLayers.Format.GeoJSON()
//, ... other wfs options ...
})
}),
autoLoad: false
});
// create grid panel configured with feature store
gridPanel = new Ext.grid.GridPanel({
title: "Feature Grid",
anchor: "100% 50%",
store: store,
columns: [{
header: "Name",
width: 200,
dataIndex: "name"
}, {
header: "Elevation",
width: 100,
dataIndex: "elevation"
}],
sm: new GeoExt.grid.FeatureSelectionModel()
});
// create form panel configured with the feature store's protocol
formPanel = new GeoExt.form.FormPanel({
anchor: '100% 50%',
protocol: store.proxy.protocol,
items: [{
xtype: "textfield",
name: "name__like",
fieldLabel: "Name"
}, {
xtype: "textfield",
name: "elevation__ge",
fieldLabel: "Max Elevation"
}],
buttons: [{
text: 'Search',
handler: function(){
//hiding inside a function to change scope to formPanel
//perform the formPanel's default filtered search action
this.search();
}
}]
});
// create main panel
mainPanel = new Ext.Window({
title:'A Filtered Attribute Search Form',
layout:'anchor',
closeAction:'hide',
closeable:true,
items:[formPanel,gridPanel]
})
mainPanel.show();
.....
Hope that helps
Matt Priour
Kestrel Computer Consulting
From: Robert Buckley
Sent: Tuesday, November 02, 2010 2:15 AM
To: users at geoext.org
Subject: [Users] Search functionality with GeoExt but without Mapfish
Hi,
I would like to have a search capability in a geoext project but I do not have Mapfish installed.
Are there any Geoext examples regarding searching through datasets coming from geoserver,
or any code snippets showing how to implement such a function using either shapefiles or postgis?
yours,
Robert Buckley
--------------------------------------------------------------------------------
_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101102/06c92de2/attachment.htm
More information about the Users
mailing list