[Users] Fill fieldset from grid

Robert Buckley robertdbuckley at yahoo.com
Thu Mar 31 14:45:40 CEST 2011


Hi,

It´s probably pretty easy to do, but I can´t find a good way to do this.

With this code the map centers in on the feature and the fieldset is populated 
with the attributes of a grid (red)


// 1 x Click in grid
gridPanel.on('rowclick', function(){
gridPanel.getSelectionModel().each(function(rec){
var feature = rec.get("feature");
InfoPanel.getForm().loadRecord(rec);
mapPanel.map.setCenter(feature.geometry.getBounds().getCenterLonLat(), 12);
})
});

This is the code to create the popup


// register a listener for the feature selection and unselection
                layer.events.on({
                    featureselected: function(event){
                        popup = new GeoExt.Popup({
                            title: "Feature Attributes",
                            feature: event.feature,
                            collapsible: true,
                            layout: "fit",
                            height: 330,
panIn: true,
                            width: 270,
unpinnable: true,
                            border: false,
                            listeners: {
                                close: function(){
                                    select.unselectAll();
                                }
                            },
                            items: [new Ext.grid.PropertyGrid({
                                autoHeight: true,
                                source: event.feature.attributes
                            })]
                        
                        });
                        popup.show();
  
                    },
                    featureunselected: function(event){
                    popup.destroy();
                    }
                    
                });


I want to fill the form also by clicking on the vector features, but cannot see 
how to do it. I have tried many things, but they all fail.


Could anyone see what I have to do?

yours,

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110331/c1724b53/attachment.htm 


More information about the Users mailing list