[OpenLayers-Users] Changing One Feature's Style
Christopher Schmidt
crschmidt at metacarta.com
Thu Sep 4 12:34:52 EDT 2008
On Thu, Sep 04, 2008 at 10:26:32AM -0600, Bill Thoen wrote:
> I've got a WFS layer of line features and I got the 'loadend' event to
> call a function, and in that function I'm trying to change a feature's
> strokeColor to yellow. Here's my code that doesn't work. But why doesn't it?
>
> function changeFirst (e) {
> e.object.features[0].style.strokeColor="#FF0";
> }
When you say 'doesn't work', what do you mean? If what you mean is
"Doesn't change the displayed feature", then the reason is 'because the
feature is already drawn'. If you zoom in, it will probably change.
I'll also point out that I highly recommend *not* styling your features
this way: OpenLayers styling framework is powerful, and should probably
be used in place of manual styling.
Regards,
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list