Select to view content in your preferred language

How to redraw a FeatureLayer (without refresh)?

2116
0
06-15-2012 08:41 AM
SarahBurgin
Emerging Contributor
I'd like to redraw a FeatureLayer without using the refresh() method. Does anyone know a way to achieve this please?

My layer contains custom symbols and I've noticed that calling FeatureLayer.refresh() results in the draw() method being called twice for every symbol. Firstly it seems that draw() is called immediately for pre-existing sprites, which enables them to update. This is all I want to do and achieves my desired effect (allows the method to make instantaneous changes to the appearance of my symbols).

However, using FeatureLayer.refresh() also updates the layer from the server, so shortly afterwards the response arrives and the draw() method is called a second time for every symbol; this time the previous sprites have been cleared and new ones are created. This isn't a problem, but it's unnecessary since the redraw that I needed was already achieved successfully without the server update and second draw()... I'd therefore like to find out if there's a way to have the layer redraw only, without the server update, unlike refresh()?

I've experimented with methods like FeatureLayer.invalidateDisplayList() and FeatureLayer.validateNow() but not really understood those or found anything that works!
Tags (2)
0 Kudos
0 Replies