[Users] display popup content in a panel

François Boussuges f.boussuges at gmail.com
Tue May 25 14:23:48 CEST 2010


Hello, I have GeoExt popup to display attributes of WFS clusters layer. 
But I have a lots (more than 10) attributes to display, the popup is not 
very efficient. I want to display this attributs in a panel (Ext.Panel 
or other) in the south of my map but I dont know what I should do.
this is my script:

var medicago = new OpenLayers.Layer.Vector(
            "Medicago",{
                extractAttributes: true,
                strategies : [ new OpenLayers.Strategy.BBOX(),
                               new OpenLayers.Strategy.Fixed()
                ,new OpenLayers.Strategy.Cluster({distance: 0.01})],
                protocol: new OpenLayers.Protocol.HTTP(
                        {url : "http://localhost:8090/geoserver/wfs?",
                            params: {format:"WFS",
                            service: "WFS",
                            version: "1.0.0",
                            request: "GetFeature",
                            typename: "MEDICAGO_VIEW",
                            SRS: "EPSG:4326"},
                            format : new OpenLayers.Format.GML()
                        }),
                        geometryName : "GEOMETRY",
                        styleMap: accession_style1
                       
            });

    var selectControl1 = new OpenLayers.Control.SelectFeature(
            medicago);
    map.addControl(selectControl1);
    selectControl1.activate();
   
    medicago.events.on({
        featureselected: function(e) {     
        if(typeof(popup) != "undefined"){
            popup.destroy();
        }
        var content ="<html><body><table cellspacing=10 
cellpading=10><tr><td>NOM ACCESSION</td><td>NUMERO ACCESSION</td><td>NOM 
SITE</td><td>TYPE DE SITE</td><tr>" ;
        for (var i=0; i < e.feature.cluster.length; ++i)
        
content+="<tr><td>"+e.feature.cluster[i].attributes.NOM_ACCESSION+"</td><td>"+e.feature.cluster[i].attributes.NUMERO_ACCESSION+"</td><td>"+e.feature.cluster[i].attributes.NOM_DU_SITE+"</td><td>"+e.feature.cluster[i].attributes.TYPE_SITE+"</td></tr>";
        content+="</table></body></html>"    
     
        popup = new GeoExt.Popup({
            feature    : e.feature,
            html: content,
            collapsible: true
            ,width      : 600
            ,height     : 250
            ,anchored   : true            
           
        });       
        popup.show();
    }
});

I try to display the html attributes in a Ext.Panel but with no result....
One ideas?


More information about the Users mailing list