[Users] FeatureStore / Grid & VectorLayer
Sascha Müller
s.mueller76 at arcor.de
Thu Oct 8 17:23:37 CEST 2009
Hi,
I try to use grid.reconfigure(). It works for me now. Also the selection
with the Popup works.
I use the code below. Does it look the way you thought?
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) {
featureStore2 = new GeoExt.data.FeatureStore({
layer: wfsStoreLayer,
proxy: new GeoExt.data.ProtocolProxy({
protocol: new OpenLayers.Protocol.WFS({
url: 'http://localhost:8081/geoserver/wfs',
featureType: theLayer,
srsName: 'EPSG:21781',
version: '1.1.0',
featureNS: "http://www.vbl.ch",
featurePrefix: "VBL"
})
})
});
featureStore2.reader = new GeoExt.data.FeatureReader({ totalProperty:
29,}, recordize(fields));
gridPanel.reconfigure(featureStore2, new
Ext.grid.ColumnModel(columnize(fields)) );
gridPanel.setTitle("Attribute des Layers: " + theLayer);
reloadFeatureStore();
}
function reloadFeatureStore() {
featureStore2.load();
}
Thanks for your Help!
Sascha
> 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
>>
>>
>
>
>
More information about the Users
mailing list