[Users] FeatureStore / Grid & VectorLayer

Sascha Müller s.mueller76 at arcor.de
Wed Oct 7 17:19:46 CEST 2009


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:&ensp;" + 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




More information about the Users mailing list