2

I want to edit object's attributes on WFS layer. I see this example http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/styles_unique_with_group_wfs.html but popup is horrible. I want to use ExtJs form to editing.
So how to edit attributes in this case?

  • Do you know in advance what the feature attributes will be, or do you need to build the form dynamically? – CHenderson Jul 24 '12 at 8:57
  • I know what attributes get in advance. – Kliver Max Jul 24 '12 at 9:25
4

At first need to create store

                          st = new GeoExt.data.FeatureStore({
                                    layer: myVecLayer,
                                    fields: [
                                        {name: 'id', type: 'int'}
                                    ],
                                     proxy: new GeoExt.data.ProtocolProxy({
                                        protocol: new OpenLayers.Protocol.WFS({
                                            version: "1.0.0",
                                            srsName:"EPSG:900913",
                                            url: "http://localhost:8080/geoserver/wfs",
                                            featureType: "filedata_temp",
                                            featureNS: "http://www.opengeospatial.net/cite",
                                            filter:Ffilter
                                        })
                                    }),
                                    autoLoad: true
                                });

Then EditorGrid

    var cm = new Ext.grid.ColumnModel({
                columns: [
                    {header: "id", 
                     dataIndex:"id",
                     editor: new Ext.form.TextField({allowBlank: false})
                    }]
    })


var ed_tab = new Ext.grid.EditorGridPanel({
                store: st,
                region: 'center',
                    cm: cm,
                height: 200,
                title:'Аттрибуты',
                    autoScroll: true,
                bbar:[{
                     xtype: 'tbbutton',
                     cls: 'x-btn-icon',
                     tooltip: "Сделать что то",
                     id: "something",
                     icon: url_servlet+'externals/gxp/src/theme/img/silk/delete.png',
                     handler: function(){
                                        ed_tab.store.proxy.protocol.commit(
                                               myVecLayer.features
                                          );
                                        ed_tab.store.reload();
                                    }
                    }]
                })


var x = new Ext.Window({
        title:'Аттрибуты',
        items:[ed_tab]  
        })
 x.show();

That all about attributes. To modifity geometry htere: Modify WFS with OpenLayers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.