0

I have a popup that gets the feature info on the map, what I want to do is to customize the display of the WMS GetFeatureInfo Results, I don't want to avoid automatic alphabetic sorting of the attribute declared on the source (see the code). Please tell me how to do that, here's my code:

  action = new GeoExt.Action({
    control: new OpenLayers.Control.WMSGetFeatureInfo({
    autoActivate: true,
    infoFormat: "application/vnd.ogc.gml",
    maxFeatures: 6,
    layers: [layer1],

    eventListeners: {
      "getfeatureinfo": function(e) {
        var items = [];
        Ext.each(e.features, function(feature) {

            items.push({
                xtype: "propertygrid",
                title: feature.fid,
                source: {"aaaaa": feature.attributes['aaaa'], "bbbb": feature.attributes['bbbb']},
            });
        });
        new GeoExt.Popup({
            title: "informations",
            width: 250,
            height: 300,
            layout: "accordion",
            map: map,
            location: e.xy,
            items: items
        }).show();

      }


    }
   }),
    map: map,
    text: "infos",
    tooltip: "Informations "
      });
    actions["infos"] = action;
    toolbarItems.push(action);
    toolbarItems.push("-"); 
  • Can you tell us, how you want the pop up to appear? and what is your geoserver version? are you getting the data back in json? – Devdatta Tengshe May 28 '13 at 13:56
  • the popup appears when the user click on a feature on the map, for geoserver it's 2.2-SNAPSHOT – Geographic May 28 '13 at 14:09
  • and am specifing in source how to get them and to get only two: {"aaaaa": feature.attributes['aaaa'], "bbbb": feature.attributes['bbbb']} but they appear on the popup with alphabetic order ( because when i inverse like this : {"bbbbb": feature.attributes['bbbb'], "aaaa": feature.attributes['aaaa']} i get aaaa before bbbb on the popup – Geographic May 28 '13 at 14:11
  • Can't you customize the HTML response of the server (and request HTML as the info format ) rather than rely on OpenLayers, or don't you have control of the server? – nmtoken Sep 8 '16 at 19:33

Your Answer

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

Browse other questions tagged or ask your own question.