2

I am trying to export vector features (current view) as a grid, something like: http://workshops.opengeo.org/geoext/wfs/grid.html

so far layer features are not being retrieved.. I got empty grid in the window. would anyone take a look and let me know if I miss something ?

gridPanel = new Ext.grid.GridPanel({ 
        title: "Feature Grid", 
        store: new GeoExt.data.FeatureStore({ 
        fields: [ 
            {name: "id", type: "int"}, 
            {name: "name", type: "string"} 
        ], 
            proxy: new GeoExt.data.proxy.Protocol({ 
            protocol: new OpenLayers.Protocol.WFS({ 
                url: "http://IP/geoserver/wfs", 
                featureType: "myLayer", 
                featureNS: "http://mapmap.org", 
                srsName: "EPSG:3857", 
                version: "1.1.0" 
            }) 
        }), 
                autoLoad: true 
                }), 
                sm: new GeoExt.selection.FeatureModel(), 
        width: 320, 
    columns: [ 
        {header: "id", dataIndex: "id"}, 
        {header: "name", dataIndex: "name"} 
    ] 
    }); 

        //window to display grid 
        var gridWindow = new Ext.Window({ 
              items: [ 
                     gridPanel 
                       ] 
            }).show();
PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Shadin
  • 469
  • 1
  • 3
  • 14

2 Answers2

1

Do you receive answer from geoserver? You should see something in firebug. I am almost sure that you have wrong value in featureNS. Check this: How to add GeoServer wfs layer on OpenLayers?

Odoakr
  • 684
  • 5
  • 12
  • I used that exact protocol to add wfs layer to my map so I am sure it's right. but now I need to export features from same wfs layer to grid but got nothing ! – Shadin Sep 20 '12 at 10:52
  • Maybe for displaying it is OK, but I am no sure if mapmap.org describes your data for GeoExt.data.FeatureStore. Do it, as it is decribed in link given. Set the namespace in geoserver and then change featureNS in your code. – Odoakr Sep 20 '12 at 13:39
  • I sat my namespace URL in geoserver to http://mapmap.org so it supposes to work here right ? what's the point of setting it to another URL ? – Shadin Sep 21 '12 at 08:37
0

What I can see so far is that you have a typo:

you have written

 proxy: new GeoExt.data.proxy.Protocol

but correct is:

proxy: new GeoExt.data.ProtocolProxy

see http://geoext.org/lib/GeoExt/data/ProtocolProxy.html

Just fiddled together a working example: http://jsfiddle.net/expedio/etzkkuno/

Thomas B
  • 8,807
  • 1
  • 21
  • 62