[mapguide-users] Re: Properties item list

JanvW jan.vonwartburg at bl.ch
Thu Sep 8 01:53:45 EDT 2011


Sorry for digging out this older post.

To show values from an attribute in the dropdown list instead of the count
of the values, one can do this:

Modify the function OnSelectedFeatureLayerChanged() in ajaxmappane.templ.

function OnSelectedFeatureLayerChanged()
{
    var sLayer = document.getElementById("selLayers");
    var layerIdx = sLayer.selectedIndex;
    var layerName = sLayer.options[layerIdx].value;
    var count = selFeatures[layerName].length;
    var auswahl = "";
       
    var sFeature = document.getElementById("selFeature");
    sFeature.length = 0;

    for (var i = 1; i <= count; i++)
    {
        // depending on the selected layer a different attribute (key) value
is being read out of selFeatures
       // and saved in auswahl

	switch (layerName) {
        
        case "Schutzzonenflaechen": auswahl =
selFeatures.Schutzzonenflaechen[i-1].values[2].value; break;
        case "Schutzzonenpunkte": auswahl =
selFeatures.Schutzzonenpunkte[i-1].values[0].value; break;
        default: auswahl = i;
	}

	if (auswahl=="" || auswahl=="-") auswahl = i; // when empty or "-", change
to count
        var opt = new Option();
        opt.text = auswahl; // fill in the result
        opt.value = 1;
        if (msie)
            sFeature.add(opt);
        else
            sFeature.add(opt, null);    
    }
   
    if (count > 0)
    {
        sFeature.selectedIndex = 0;
        OnSelectedFeatureChanged();
    }
}

Regards,
Jan

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Properties-item-list-tp6669969p6770603.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list