1

I followed a GeoEXT example to create a popup menu that gets WMS GetFeatureInfo on click on the map. What I want to do is to get some specific fields not all the fields; I tried the propertyName (with name1,name2 and name3) and defined the wanted fields but it doesn't work. I also want to change the title by bringing a specific value not the fid, but it doesn't work, here's the code:

 feature Control, a "button" control
    action = new GeoExt.Action({
    control: new OpenLayers.Control.WMSGetFeatureInfo({
    autoActivate: true,
    infoFormat: "application/vnd.ogc.gml",
    maxFeatures: 6,
    layers: [layers1],
    propertyName: "name1,name2,name3",  
    eventListeners: {
    "getfeatureinfo": function(e) {
        var items = [];
        Ext.each(e.features, function(feature) {    
            items.push({
               xtype: "propertygrid",
               title: feature.fid, // here I changed it to feature.name1 it doesn't work
               source: feature.attributes               
            });
        });
        new GeoExt.Popup({
            title: "infos",
            width: 250,
            height: 300,
            layout: "accordion",
            map: map,
            location: e.xy,
            items: items
        }).show();
      }
    }
   }),
    map: map,
    text: "infos",
    tooltip: "Infos "
      });
    actions["infos"] = action;
    toolbarItems.push(action);
    toolbarItems.push("-");     
1
  • 1
    Try "feature.attributes.name1"
    – atlefren
    Commented May 28, 2013 at 13:45

1 Answer 1

1

Replace

propertyName: "name1,name2,name3", 

with:

vendorParams: {
                propertyName: "name1"
            }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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