[Users] FeatureStore / Grid & VectorLayer
Andreas Hocevar
ahocevar at opengeo.org
Wed Oct 7 21:11:58 CEST 2009
Hey-
I don't think it is possible to just set proxy and reader of a store and
then load it again. You need to create a new store and use
grid::reconfigure to assign it the new store.
Regards,
Andreas.
Sascha Müller wrote:
> Hi,
>
> I have a featureStore with a Grid and a OL VectorLayer.
> I use the radioButtons in the treePanel for selecting the active Layer.
> When I check a radioButton, the features from the layer are load into
> the grid
> and the VectorLayer is shown in the map for each feature. Like in the
> Drake example.
> This works fine if I use at first one Layer which is load to the grid.
> If I want to enable
> that I can choose between all Layer in the treePanel, I try to use the
> createProyx() method
> like it is used in Drake (see below my createProxy method).
>
> function createProxy(layer) {
> var type = layer || featureType;
> var proto = new OpenLayers.Protocol.WFS({
> url: 'http://localhost:8081/geoserver/wfs',
> featureType: type,
> featureNS: "http://www.vbl.ch",
> featurePrefix: "VBL",
> srsName: "EPSG:4326",
> version: "1.1.0"
> });
> return new GeoExt.data.ProtocolProxy({protocol: proto});
> }
>
> The featureStore looks like that:
>
> featureStore = new GeoExt.data.FeatureStore({
> layer: wfsStoreLayer,
> proxy: createProxy()
> });
>
> This Functions are invoked from the radioButton in the treePanel:
>
> function load2Store(selectedLayer) {
> attributStore = new GeoExt.data.AttributeStore({
> url: "http://localhost:8081/geoserver/wfs?service=WFS&request=DescribeFeatureType&version=1.1.0&typeName=VBL:"+
> selectedLayer
> });
> attributStore.load({
> callback: function(x){
> fields = [];
> for (var i = 0; i < x.length; i++){
> fields.push(x[i].data);
> }
> finishActivating(selectedLayer);
> },
> scope: this
> });
> }
>
> function finishActivating(theLayer) {
>
> featureStore.proxy = createProxy(theLayer);
> featureStore.reader = new GeoExt.data.FeatureReader({},
> recordize(fields));
>
> gridPanel.colModel.setConfig(columnize(fields));
> gridPanel.setTitle("Attribute des Layers: " + theLayer);
>
> reloadFeatureStore();
> }
>
> function reloadFeatureStore() {
> featureStore.load();
> }
>
> If I use the create Proxy Method, the VectorLayer isn't show up un the
> MapPanel.
> I Know there is a difference between Drake and Geoext. But maybe the
> difference
> isn't cause of the problem.
>
> Thanks for help!
>
> Sascha Müller
>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list