Shadin
Shadin

Reputation: 339

how to show vector features in OpenLayers after hiding it?

I did change some features style (through check-boxes) using style property :

var features = layer.features;

for( var i = 0; i < features.length; i++ ) {
  //features[i].style = { visibility: 'hidden' };
    features[i].style = 'none'; 
}

layer.redraw();

Now if I check the box again, it supposed to display again but nothing happens! I tried:

     features[i].style = 'block'; 
OR
     features[i].style = 'delete'; 

then redraw the layer.. but this doesn't work

Any Idea ?

Upvotes: 0

Views: 824

Answers (1)

winsent
winsent

Reputation: 486

Try this:

// set style
    features[i].style = null;
// or
    features[i].style = {display:'none'};

// redraw feature
layer.drawFeature(features[i]);

Upvotes: 2

Related Questions