layer.refresh() problem

182
1
Jump to solution
02-22-2021 11:06 AM
JamesCrandall
MVP Frequent Contributor

Edit: The weblayer in the webmap has a refresh interval =1 set and the webmap viewer does what I expect when it "refreshes". Hope that makes sense!

Part of a workflow is to update a value and then refresh the layer and my expectation is that the symbol would change to the unique value of the updated value.

I am setting a selectionLayer variable like so, 

 

 

array.map(_operLayers, lang.hitch(this, function (lyr) {
                    if (lyr.layerObject) {
                        if (lyr.visibility === true) {
                            this.selectionLayer = lyr.layerObject;
                        }
                    }
                }));

 

 

 

Then attribute edits are applied and a refresh is called,

 

 

this.selectionLayer.refresh();

 

 

 

While the layer seemingly "refreshes" or redraws, the symbology change I am expecting does not happen.  Curious if there's something simple I'm missing.

Consequently, if I refresh the entire WAB/page, of course the symbology draws to what I expect.

 

Javascript 3.x

WABDev/Custom widget

The source to this WAB is a saved webmap with saved weblayer items.  So, my attempt/goal here is to configure items as much as possible rather that write a ton of Javascript in the UI.  

0 Kudos
1 Solution

Accepted Solutions
JamesCrandall
MVP Frequent Contributor

The solution is to clear the selection first before the refresh:

this.selectionLayer.clearSelection();
this.selectionLayer.refresh();

View solution in original post

0 Kudos
1 Reply
JamesCrandall
MVP Frequent Contributor

The solution is to clear the selection first before the refresh:

this.selectionLayer.clearSelection();
this.selectionLayer.refresh();

View solution in original post

0 Kudos