AnsweredAssumed Answered

Problem with updating legend in Legend widget

Question asked by rolandoflorez17 on Feb 9, 2017
Latest reply on Feb 14, 2017 by rolandoflorez17

This is the problem:

I'm developing a widget that allows classify the visualization of thematic layers depending of selected field.

So, when I apply the render the first time, the legend works fine. Now, if I change de layer, it applies the render but legend take the default value, not the current value. This happens sometimes but not always, I don't understand what is hapenning.

 

This is my code when I create the Legend:

createLegend: function () {
   htmlF = "<div id='legendDiv' ></div>";
   var node = domConstruct.toDom(htmlF);
   domConstruct.place(node, 'legendField');
   this.legend = new Legend({
      map: this.map,
      layerInfos: [{
         hideLayers: this.parameters.idHideLayers,
         layer: this.parameters.layer,
         title: this.parameters.layer.title
      }
   ]
}, 'legendDiv');
   this.legend.startup();
   this.legend.refresh();
}

 

The Legend also takes an array of sublayer Ids that will be hide.

 

thematic classification

Outcomes