I am trying to incorporate a feature attributes onto the 'EditOverlay' layer on client-side. I attempted to follow an Openlayers example (openlayers.org/dev/examples/vector-features-with-text.html). However, I can't seem to get it to work completely. My question, it's possible to incorporate this functionality with WebEdition 3.1.16. If yes, It's possible to retrieve those attribute values on server-side.
Currently, I could add shape text attributes by feature.fieldValues. However, I would have to do a postback to display the feature's label/description. Ideally, I would like to handle all features manipulation on the client-side if possible.
Below is the code I use to add the attribute and set the vector layer style. Please advice. Thanks
//Add point with a description on client-side
function AddShapeDesc(latlon, strDesc) {
var map = Map1.GetOpenLayersMap();
var layerFeatures = map.getLayersByName('EditOverlay');
var point = new OpenLayers.Geometry.Point(latlon.lon, latlon.lat);
var ptTextFeature = new OpenLayers.Feature.Vector(point);
ptTextFeature.attributes = {
name: "45 ft",
age: "dd"
};
layerFeatures[0].addFeatures(ptTextFeature);
}
/*
Set default and select properties of drawn shape
*/
function SetVectorStyle()
{
OpenLayers.Feature.Vector.style['default']['fillColor'] = '#EEEEEE';
OpenLayers.Feature.Vector.style['default']['strokeColor'] = '#FFFFFF';
OpenLayers.Feature.Vector.style['default']['pointRadius'] = '4';
OpenLayers.Feature.Vector.style['default']['fillOpacity'] = '0.6';
OpenLayers.Feature.Vector.style['default']['strokeWidth'] = '4';
OpenLayers.Feature.Vector.style['default']['strokeOpacity'] = '0.75';
OpenLayers.Feature.Vector.style['default']['label'] = "name: ${name}, age: ${age}",
OpenLayers.Feature.Vector.style['select']['fillColor'] = '#FF9900';
OpenLayers.Feature.Vector.style['select']['strokeColor'] = '#000066';
OpenLayers.Feature.Vector.style['select']['pointRadius'] = '4';
OpenLayers.Feature.Vector.style['select']['fillOpacity'] = '0.6';
OpenLayers.Feature.Vector.style['select']['strokeWidth'] = '4';
OpenLayers.Feature.Vector.style['select']['strokeOpacity'] = '0.75';
}
function OnMapCreating(map) {
SetVectorStyle();
}