Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

1 Answer

up vote 4 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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