[OpenLayers-Users] changing the state of a selected feature

Marco Scheuble mail at marco-scheuble.de
Tue Jan 5 05:57:12 EST 2010


Hi list,

after selecting a feature and editing its attributes, I want to save the 
changes.
Unfortunately the state of the selected feature isn't set, so changes 
would not be saved.
Trying to set the state manually with: feature.toState() won't work, too.

I'm doing it like this:
point.events.on({
    "featureselected": function(e) {
     showAttributes(e.feature);
   },
   "featureunselected": function(e) {
     hideAttributes(e.feature);
   }
});

function showAttributes(feature){
     document.getElementById("label").value = feature.attributes.label;
}

function hideAttributes(feature){
     feature.attributes.label = document.getElementById("label").value;
     feature.toState("Update");
     alert(feature.state);
}

alert(feature.state) -> null

anyone can help me?
cheers, marco



More information about the Users mailing list